EOF & DISTINCT/ORDER BY problem - need help...

Simeon Johnston <[email protected]> Thu, 27 Jan 2005 10:48:31 -0600
Newsgroups gmane.comp.web.webobjects.devel,gmane.comp.web.webobjects.eof
Message-ID <[email protected]>
This sql was generated by EOF -

SELECT DISTINCT t0.A_BOOLEAN, t0.A_VARCHAR, t0.THE_PK, t0.LABEL, 
t0.TYPE FROM THE_STUPID_TABLE t0 WHERE (t0.A_BOOLEAN = true AND t0.TYPE 
= 2) ORDER BY UPPER(t0.LABEL) ASC

-
And error out with -

Next exception:SQL State:42P10 -- error code: 0 -- msg: ERROR: for 
SELECT DISTINCT, ORDER BY expressions must appear in select list

--

After looking around for a while I've discovered that the SQL, 
basically, just doesn't work.  It doesn't work in either PostgreSQL or 
FrontBase, though FrontBase gives a more useless error.
It seems that there is a problem with using ORDER BY with DISTINCT 
queries when using UPPER()/LOWER()...  I couldn't figure out exactly 
what the problem was.

OK.. great.  Bad SQL.
So how do I fix it so that EOF will generate correct SQL?
It works without the upper() statement, but I need it to sort case 
insensitively.
It also works if I select the field as upper() initially i.e. -
SELECT DISTINCT t0.A_BOOLEAN, t0.A_VARCHAR, t0.THE_PK, UPPER(t0.LABEL), 
t0.TYPE FROM THE_STUPID_TABLE t0 WHERE (t0.A_BOOLEAN = true AND t0.TYPE 
= 2) ORDER BY UPPER(t0.LABEL) ASC
--
OK, but how do I get that to happen automatically?

Or is there a better way to fix this problem?

Using WO 5.2.3 w/ PostgreSQL 7.4.6 & jdbc driver w/ Hexdreams plugin.

sim