Re: [SQL] nulls and datetime

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
Cc: Gary MacMinn <G(dot)MacMinn(at)nca(dot)gov(dot)au>, pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] nulls and datetime
Date: 1999-11-15 15:41:45
Message-ID: 18520.942680505@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu> writes:
> In previous versions, single-argument functions with NULL input were
> short-circuited in fmgr (??) and never actually were called.

As long as I've been paying attention (which is only since 6.4 or so),
execQual+fmgr will call the function regardless of the NULL status of
the inputs. But the NULL flag for the output is taken to be the OR of
the input NULL flags --- so you can't return anything but NULL for a
NULL input, yet the function code is run anyway.

(Actually, a single-argument function is passed the isNull pointer as
an undocumented second argument, so it's possible for such a function
to clear isNull and thus return non-NULL for NULL input. ISNULL and
ISNOTNULL work that way, but I haven't seen anything else that uses it.)

This is an incredibly ugly set of kluges, of course, and I'm hoping
to get it cleaned up for 7.0. See my past memos to pg-hackers on fmgr
redesign.

> 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.

If you don't fix it sooner, I will change it when I pass through that
code doing the fmgr interface changes...

regards, tom lane

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Thomas Lockhart 1999-11-15 16:11:22 Re: [SQL] nulls and datetime
Previous Message Thomas Lockhart 1999-11-15 15:29:43 Re: [SQL] nulls and datetime