Re: AW: to_char() dumps core - Mailing list pgsql-hackers

From Tom Lane
Subject Re: AW: to_char() dumps core
Date
Msg-id 8053.972308614@sss.pgh.pa.us
Whole thread Raw
In response to AW: to_char() dumps core  (Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at>)
List pgsql-hackers
Zeugswetter Andreas SB <ZeugswetterA@wien.spardat.at> writes:
> For pass by reference datatypes setting the reference to a null pointer
> for a NULL value imho would be a fine thing in addition to the indicator, 
> no ?

At the moment it generally will be, but that's not certain to be true
forever.  I believe we've had discussions in the past about supporting
multiple kinds of NULL.  (I had the idea this was actually required by
SQL99, in fact, though I can't find anything about it at the moment.)

The obvious way to do that is to commandeer the otherwise unused
contents of a Datum when the associated null-flag is true.  At that
point checking the null-flag will be the only valid way to check for
NULL.

Assuming that the null-kind values are small integers, attempts to
dereference them will still SEGV on reasonable systems, so I don't
think any error checking is lost.  Just don't do "if (datum == NULL)".
        regards, tom lane


pgsql-hackers by date:

Previous
From: Philip Warner
Date:
Subject: Re: relation ### modified while in use
Next
From: Tom Lane
Date:
Subject: Re: AW: AW: relation ### modified while in use