agora inbox for pgsql-sql@postgresql.orghelp / color / mirror / Atom feed
Global setting for ORDER BY ... NULLS FIRST / LAST 4+ messages / 3 participants [nested] [flat]
* Global setting for ORDER BY ... NULLS FIRST / LAST @ 2022-03-01 14:16 Sebastien Flaesch <sebastien.flaesch@4js.com> 0 siblings, 1 reply; 4+ messages in thread From: Sebastien Flaesch @ 2022-03-01 14:16 UTC (permalink / raw) To: pgsql-sql <pgsql-sql@lists.postgresql.org> Hello! Is there a global PostgreSQL server setting or SQL session parameter that defines the default for ORDER BY ... NULLS FIRST / LAST ? Assuming that it would be something like "NULL is lowest value, or NULL is highest value", to get the expected behavior when using ASC/DESC options of ORDER BY ... That would help to migrate to PostgreSQL for DB engines having a different default behavior regarding NULL sorting. Thanks! Seb ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Global setting for ORDER BY ... NULLS FIRST / LAST @ 2022-03-01 14:41 David G. Johnston <david.g.johnston@gmail.com> parent: Sebastien Flaesch <sebastien.flaesch@4js.com> 0 siblings, 1 reply; 4+ messages in thread From: David G. Johnston @ 2022-03-01 14:41 UTC (permalink / raw) To: Sebastien Flaesch <sebastien.flaesch@4js.com>; +Cc: pgsql-sql <pgsql-sql@lists.postgresql.org> On Tue, Mar 1, 2022 at 7:16 AM Sebastien Flaesch <sebastien.flaesch@4js.com> wrote: > Is there a global PostgreSQL server setting or SQL session parameter that > defines the default for ORDER BY ... NULLS FIRST / LAST ? > Nope Assuming that it would be something like "NULL is lowest value, or NULL is > highest value", to get the expected behavior when using ASC/DESC options of > ORDER BY ... > I don't think I quite follow the above, but may I suggest you read our excellent documentation on how the feature presently functions before making suggestions on how to change it. > That would help to migrate to PostgreSQL for DB engines having a different > default behavior regarding NULL sorting. > IMO, not enough of a benefit to spend development time on. Having global configuration like this is something that should be, and in general is, avoided. Most of the exceptions to this have been regretted. David J. ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Global setting for ORDER BY ... NULLS FIRST / LAST @ 2022-03-01 15:02 Tom Lane <tgl@sss.pgh.pa.us> parent: David G. Johnston <david.g.johnston@gmail.com> 0 siblings, 1 reply; 4+ messages in thread From: Tom Lane @ 2022-03-01 15:02 UTC (permalink / raw) To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: Sebastien Flaesch <sebastien.flaesch@4js.com>; pgsql-sql <pgsql-sql@lists.postgresql.org> "David G. Johnston" <david.g.johnston@gmail.com> writes: > On Tue, Mar 1, 2022 at 7:16 AM Sebastien Flaesch <sebastien.flaesch@4js.com> > wrote: >> Is there a global PostgreSQL server setting or SQL session parameter that >> defines the default for ORDER BY ... NULLS FIRST / LAST ? > IMO, not enough of a benefit to spend development time on. Having global > configuration like this is something that should be, and in general is, > avoided. Most of the exceptions to this have been regretted. Yeah. We have generally found that settings that change query semantics are a net evil. regards, tom lane ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: Global setting for ORDER BY ... NULLS FIRST / LAST @ 2022-03-02 12:23 Sebastien Flaesch <sebastien.flaesch@4js.com> parent: Tom Lane <tgl@sss.pgh.pa.us> 0 siblings, 0 replies; 4+ messages in thread From: Sebastien Flaesch @ 2022-03-02 12:23 UTC (permalink / raw) To: Tom Lane <tgl@sss.pgh.pa.us>; David G. Johnston <david.g.johnston@gmail.com>; +Cc: pgsql-sql <pgsql-sql@lists.postgresql.org> OK I understand. Seb ________________________________ From: Tom Lane <tgl@sss.pgh.pa.us> Sent: Tuesday, March 1, 2022 4:02 PM To: David G. Johnston <david.g.johnston@gmail.com> Cc: Sebastien Flaesch <sebastien.flaesch@4js.com>; pgsql-sql <pgsql-sql@lists.postgresql.org> Subject: Re: Global setting for ORDER BY ... NULLS FIRST / LAST EXTERNAL: Do not click links or open attachments if you do not recognize the sender. "David G. Johnston" <david.g.johnston@gmail.com> writes: > On Tue, Mar 1, 2022 at 7:16 AM Sebastien Flaesch <sebastien.flaesch@4js.com> > wrote: >> Is there a global PostgreSQL server setting or SQL session parameter that >> defines the default for ORDER BY ... NULLS FIRST / LAST ? > IMO, not enough of a benefit to spend development time on. Having global > configuration like this is something that should be, and in general is, > avoided. Most of the exceptions to this have been regretted. Yeah. We have generally found that settings that change query semantics are a net evil. regards, tom lane ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2022-03-02 12:23 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2022-03-01 14:16 Global setting for ORDER BY ... NULLS FIRST / LAST Sebastien Flaesch <sebastien.flaesch@4js.com> 2022-03-01 14:41 ` David G. Johnston <david.g.johnston@gmail.com> 2022-03-01 15:02 ` Tom Lane <tgl@sss.pgh.pa.us> 2022-03-02 12:23 ` Sebastien Flaesch <sebastien.flaesch@4js.com>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox