Received: from sss.sss.pgh.pa.us (sss.pgh.pa.us [206.210.65.6]) by hub.org (8.9.3/8.9.3) with ESMTP id KAA88288 for ; Tue, 15 Jun 1999 10:03:50 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.sss.pgh.pa.us (8.9.1/8.9.1) with ESMTP id KAA22615; Tue, 15 Jun 1999 10:02:30 -0400 (EDT) To: Ken Plumbly cc: pgsql-interfaces@hub.org Subject: Re: [INTERFACES] order by in c (libpq)? In-reply-to: Your message of Mon, 14 Jun 1999 19:56:07 -0700 <3765C0C7.C401342E@ocol.com> Date: Tue, 15 Jun 1999 10:02:30 -0400 Message-ID: <22613.929455350@sss.pgh.pa.us> From: Tom Lane Ken Plumbly writes: > I am sending the query thusly: > sprintf(querystr, "select * from %s order by %s", table, field); > However the query always comeback in the order in which the data was > originally entered into the data base. That is odd, and fairly hard to credit. One thing I'd wonder about right away is if you are actually sending the query you think you are. You might try turning on debug tracing in the backend (make the connection with PGOPTIONS = "-d 1" or "-d 2" or so) and checking the postmaster log to see what query the backend reports receiving. If you can duplicate the failure-to-order when issuing the query manually in psql, then you've got a backend bug that ought to be reported as such. But first I'd suspect some silly little typo in your app code, like sending the wrong query string or inspecting the wrong PGresult... regards, tom lane