pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Thomas Lockhart <lockhart@alumni.caltech.edu>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Gary MacMinn <G.MacMinn@nca.gov.au>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] nulls and datetime
Date: Mon, 15 Nov 1999 15:29:43 +0000
Message-ID: <383026E7.11E9B7A1@alumni.caltech.edu> (raw)
References: <15251.942646251@sss.pgh.pa.us>

> > I have a table with datetime fields, some of which are null. I'm
> > trying to extract the date and time components with the date() and
> > time() functions but the null values break these functions.
> regression=>  SELECT t1, date(d1) from test1;
> ERROR:  Unable to convert null datetime to date
> This is undesirable, I agree.  It seems to me that those routines should
> just return NULL given NULL input, rather than going out of their way to
> break applications.  Thomas, can you defend this behavior?

No, other than this is the first time I've ever seen that code execute
;)

In previous versions, single-argument functions with NULL input were
short-circuited in fmgr (??) and never actually were called. I put in
this code just as a guard.

Seems to me that NULL in should produce NULL out, which was the old
behavior. I'll add this to my ToDo, unless someone else has already
picked it up.

                      - Thomas

-- 
Thomas Lockhart				lockhart@alumni.caltech.edu
South Pasadena, California



view thread (5+ messages)  latest in thread

Message-ID: <383026E7.11E9B7A1@alumni.caltech.edu>
Permalink:  ../383026E7.11E9B7A1@alumni.caltech.edu/
Also on:    postgresql.org/message-id/383026E7.11E9B7A1@alumni.caltech.edu

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-sql@postgresql.org
  Cc: lockhart@alumni.caltech.edu, tgl@sss.pgh.pa.us, G.MacMinn@nca.gov.au
  Subject: Re: [SQL] nulls and datetime
  In-Reply-To: <383026E7.11E9B7A1@alumni.caltech.edu>
  References: <15251.942646251@sss.pgh.pa.us> <383026E7.11E9B7A1@alumni.caltech.edu>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox