Skip site navigation (1) Skip section navigation (2)

Re: SQL question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Philip Warner <pjw(at)rhyme(dot)com(dot)au>
Cc: Carolyn Lu Wong <carolyn(at)kss(dot)net(dot)au>, "pgsql-sql(at)postgresql(dot)org" <pgsql-sql(at)postgresql(dot)org>
Subject: Re: SQL question
Date: 2000-07-17 05:48:48
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-sql
Philip Warner <pjw(at)rhyme(dot)com(dot)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

In response to


pgsql-sql by date

Next:From: Thomas LockhartDate: 2000-07-17 06:23:22
Subject: Re: SQL question
Previous:From: Philip WarnerDate: 2000-07-17 04:11:52
Subject: Re: SQL question

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group