Re: SQL question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Thomas Lockhart <lockhart(at)alumni(dot)caltech(dot)edu>
Cc: Philip Warner <pjw(at)rhyme(dot)com(dot)au>, 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 06:26:31
Message-ID: 28629.963815191@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:
>> 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.

> That's not a bug, that was a feature, sort of. At least when I coded it,
> Postgres *refused* to call any routine with NULL input, assuming that
> NULL would be returned.

Well before my time, I guess --- as long as I've been paying attention,
the function manager's approach was to call the routine first and *then*
insert a NULL result ... if the routine hadn't crashed first. That's
about as braindead a choice as I can think of, but that's what it did.

> A clever short-circuit, and the elog(ERROR) in
> the conversion routine was just a safety net. Because it was also the
> case that any routine returning a NULL pointer crashed the backend.
> Now that those things aren't true, we are rewriting history to say that
> they were bugs all along, eh? ;)

Fixing that one routine to behave that way, when none of the hundreds
of others that might see a NULL input do the same, qualifies as a bug
IMHO. But it's all water over the dam, now that fmgr has been
redesigned.

regards, tom lane

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Philip Warner 2000-07-17 06:31:29 Re: SQL question
Previous Message Thomas Lockhart 2000-07-17 06:23:22 Re: SQL question