Re: "order by" and "order by asc" returning different results on date field
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Rick Gentry <rick.gentry@zenus-biometrics.com>
Cc: pgsql-bugs@postgresql.org
Date: 2018-05-15T18:59:53Z
Lists: pgsql-bugs
Rick Gentry <rick.gentry@zenus-biometrics.com> writes: > I have a table that I'm using to log results from my system. It has a > field "created timestamp default current_timestamp." > Running the query "select * from tbl_log order by created asc;" works as > expected. > Running the query "select * from tbl_log order by created;" returns sorted > chunks of 2000 records. It's quite hard to believe that the ASC annotation affects anything; it's easily proven that PG's parser creates identical parsetrees for those two statements. I have to guess that there is some other effect involved here. To start with, what PG version is this, what do you mean exactly by "sorted chunks", and what client-side code are you using? Can you create a self-contained example of the misbehavior? regards, tom lane