Re: tuple compare involving NULL - Mailing list pgsql-novice

From Tobias Florek
Subject Re: tuple compare involving NULL
Date
Msg-id 53EB8377.6070600@ibotty.net
Whole thread Raw
In response to Re: tuple compare involving NULL  (David G Johnston <david.g.johnston@gmail.com>)
List pgsql-novice
hi,

 > This isn't really useful context, to me at least.

sorry to hear that.

 > It tells me nothing of why you need an artificial PK

i don't understand what you mean with artificial. id _is_ the primary key.


 > or why you think a and b need to allow null.

they do. i don't control the database layout and i have to support
pagination involving NULLs in order by columns.


 > The where clause is odd with its mix of q and t in the same row value

it is to allow ascending order on the first and descending order on the
second.


 > and q.id is technically broken though I know this is just an
 > example.

why is it? whenever (q.a, q.b) = (t.a, t.b) you need another (unique)
key to seek to the next row. maybe i am missing things.


 > As muchas arbitrary default values suck they are at least better
 > than null in this regard.  You can use coalesce for any data type.

is there a special value (of every type) that is minimal for ever
comparison (except with itself)? if so i could easily compare
  (COALESCE(t.a, MINIMAL VALUE), COALESCE(q.b, MINIMAL VALUE), t.id)

thank you for your time,
  tobias florek


pgsql-novice by date:

Previous
From: Tom Lane
Date:
Subject: Re: tuple compare involving NULL
Next
From: Tob
Date:
Subject: Re: tuple compare involving NULL