Re: SQL question - Mailing list pgsql-sql

From Tom Lane
Subject Re: SQL question
Date
Msg-id 28464.963812928@sss.pgh.pa.us
Whole thread Raw
In response to Re: SQL question  (Philip Warner <pjw@rhyme.com.au>)
List pgsql-sql
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


pgsql-sql by date:

Previous
From: Philip Warner
Date:
Subject: Re: SQL question
Next
From: Thomas Lockhart
Date:
Subject: Re: SQL question