Philip Warner <pjw@rhyme.com.au> writes:
> Another alternative would be to define a 'coalesce' function (I don't think
> PG has one), which takes an arbitrary number of arguments and returns the
> first non-null one.
We surely do have that! It even works pretty well in 7.0 ;-)
(I think there were still some bugs lurking in 6.5.)
The immediate cause of this gripe was discussed just a day or so ago
on one or another of the pgsql lists. The timestamp-to-date conversion
routine has this weird idea that it should kick out an error instead
of returning NULL when presented with a NULL timestamp. That's a bug
IMHO, and I've already changed the code in current sources.
COALESCE would be a good workaround if you don't want to patch your
local copy of 7.0.*.
regards, tom lane