Received: from sss2.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.10.1/8.10.1) with ESMTP id e6H5na063322 for ; Mon, 17 Jul 2000 01:49:36 -0400 (EDT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss2.sss.pgh.pa.us (8.9.3/8.9.3) with ESMTP id BAA28467; Mon, 17 Jul 2000 01:48:48 -0400 (EDT) To: Philip Warner cc: Carolyn Lu Wong , "pgsql-sql@postgresql.org" Subject: Re: SQL question In-reply-to: <3.0.5.32.20000717141152.022dd100@mail.rhyme.com.au> References: <3.0.5.32.20000717121856.022cd100@mail.rhyme.com.au> <3.0.5.32.20000717141152.022dd100@mail.rhyme.com.au> Comments: In-reply-to Philip Warner message dated "Mon, 17 Jul 2000 14:11:52 +1000" Date: Mon, 17 Jul 2000 01:48:48 -0400 Message-ID: <28464.963812928@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200007/165 Philip Warner 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