Is there a configuration option somewhere or anything that will allow me to force postgres to use NULLS LAST on every query that uses DESC ordering?
I dont want to rewrite all queries from Criteria API to JPQL in my app, and it seems JPA Criteria API does not allow setting nulls last option.
No. At least I never heard of such. Simple check does not give hope for it either:
t=# select setting, name from pg_settings where name like '%null%';
setting | name
---------+-----------------------
on | array_nulls
off | transform_null_equals
(2 rows)
https://www.postgresql.org/docs/current/static/queries-order.html does not mention such global switches either, just:
The NULLS FIRST and NULLS LAST options can be used to determine whether nulls appear before or after non-null values in the sort ordering. By default, null values sort as if larger than any non-null value; that is, NULLS FIRST is the default for DESC order, and NULLS LAST otherwise.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With