On 2016-12-08 18:03:04 -0500, Tom Lane wrote:
> Andres Freund <andres@anarazel.de> writes:
> > On 2016-12-08 17:38:38 -0500, Tom Lane wrote:
> >> The habit of zero-initializing Datums has got exactly nothing to do with
> >> V0 functions; it's about ensuring consistent results and avoiding
> >> heisenbugs from use of uninitialized memory. I do not think we should
> >> drop it.
>
> > Well, V0 functions don't have a real way to get information about NULL,
> > and we allow non-strict V0 functions, so?
>
> Non-strict V0 functions are pretty fundamentally broken, although IIRC
> there was some hack whereby they could see the isnull marker for their
> first argument, which is why we didn't just disallow the case. There was
> never any expectation that checking for value == 0 was an appropriate
> coding method for detecting nulls, because it couldn't work for
> pass-by-value data types.
Well, we have a bunch in our regression tests ;). And I'm not saying
it's *good* that they rely on that, I think it's a reason to drop the
whole V0 interface.
(I also suspect there's a bunch in brin related to this)
> Again, the point of initializing those values is not to support broken
> tests for nullness. It's to ensure consistent behavior in case of
> buggy attempts to use null values.
Well, it also makes such attempts undetectable. I'm not really convinced
that that's such an improvement.
Greetings,
Andres Freund