pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Carlos <carlos@solaria-mediterranea.com>
To: pgsql-sql@postgresql.org
Subject: Select distinct and order by.
Date: Wed, 11 Jul 2001 10:41:41 +0200
Message-ID: <3B4C1145.97056A0A@solaria-mediterranea.com> (raw)


Hi all:

We have developed an aplication in C with postgresql, using libpq. Our
version of development is Postgresql 6.5.3 and it works fine.

Now we are migrating the application to various flavours of Linux
(S.u.s.e 7.1, tha uses postgresql 7.0.3; Debian Potato, that uses
postgresql 7.0.2) and in these dists the next query fails.

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

Whatever this query works fine in postgresql 6.5.3.

Is correct this query and so there was a bug on 6.5.3 or there is a bug
on the new versions?.

Also in certains situations (in versions 7.0.x) this query fails from
libpq:

Select distinct field1, field2, field3 from table1 order by field1,
field2;

but if we copy the statement with mouse and do:

  $psql -d ourdb -c "Select distinct field1, field2, field3 from table1
order by field1, field2;" WORKS FINE.

These last situation are in a transaction whith some tables locked, that
aren't table1.

TIA

Carlos.
Solaria Mediterranea, S.L.L:

P.S.: please send me the answers directly, because I isn't subscribed to
the list.



view thread (8+ messages)  latest in thread

Message-ID: <3B4C1145.97056A0A@solaria-mediterranea.com>
Permalink:  ../3B4C1145.97056A0A@solaria-mediterranea.com/
Also on:    postgresql.org/message-id/3B4C1145.97056A0A@solaria-mediterranea.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: carlos@solaria-mediterranea.com
  Subject: Re: Select distinct and order by.
  In-Reply-To: <3B4C1145.97056A0A@solaria-mediterranea.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox