On Wed, 11 Jul 2001, Carlos wrote:

> Select distinct field1, field2 from table1 order by field3;
>
> The value return by PQresultErrorMessage is:
>
> For SELECT DISTINCT, ORDER BY expressions must appear in target list

That's because this query is ambiguous.

What if table1 looks like this:

field1  field2  field3
------  ------  ------
a       b       1
a       b       3
c       d       2

What should your query return then?  Both

a       b
c       d

and

c       d
a       b

are valid, depending on which 'a b' row was chosen.

If 6.5.3 allowed that, it was a mistake to rely on it because the answer
is undefined.
-- 
Tod McQuillin


---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/users-lounge/docs/faq.html

Reply via email to