Only for the record: I just noticed that another simple workaround is
ordering by something like start_date is not null, start_date,
end_date is null, end_date. SA could also implement nullsfirst()/
nullslast() that way if the database engine does not support nulls
first/nulls last.
On Jun 9, 2008, at 11:34 AM, Christoph Zwerschke wrote:
I need to order a table by start and end dates, where null values
should
be interpreted as prior to all values for start dates and later
than
all values for end dates.
This could be realized with nulls first, nulls last, but it
Michael Bayer wrote:
I tend to use a CASE statement for this: CASE WHEN x IS NULL THEN 0
ELSE x . We have case() construct for that.
Yes, but that still leaves me with having to code infinity some way.
For your version, use func.coalesce(start, literal_column(timestamp '-
infinity'))
On Jun 9, 2008, at 12:56 PM, Christoph Zwerschke wrote:
Michael Bayer wrote:
I tend to use a CASE statement for this: CASE WHEN x IS NULL THEN 0
ELSE x . We have case() construct for that.
Yes, but that still leaves me with having to code infinity some way.
For your version, use