Re: BUG #2948: default null values for not-null domains

From: Sergiy Vyshnevetskiy <serg(at)vostok(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #2948: default null values for not-null domains
Date: 2007-02-01 21:51:32
Message-ID: Pine.LNX.4.64.0702012234230.22446@uanet.vostok.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Thu, 1 Feb 2007, Tom Lane wrote:

> Sergiy Vyshnevetskiy <serg(at)vostok(dot)net> writes:
>> If input function IS strict then nulls are ALWAYS accepted.
>> If input function IS NOT strict then nulls MIGHT be rejectted.
>> And the patch is much more simple now (attached).
>> Is that it?
>
> Almost right. exec_assign_value() thinks its isNull argument is the
> null flag for the *source* value (not sure why it's pass by reference).

Because the value may change during type cast. From null to non-null too.
Or vice-versa. I'll try it later.

> As you set it up, var->isnull would be aliased by *isNull, which might
> manage to break things within that function if the code were ever
> rearranged.
>
> Also, some comments are usually a good idea (if the purpose were
> obvious, it'd have been right the first time, no?),

I will, when I'm sure what I'm doing. For now it's mostly "mokey see -
monkey do".

> and you always need to check the regression tests --- it turns out that
> the wrong behavior was actually being exposed by the tests.

Hmm? Oh, yeah, I /heard/ something about them ... I think. :)

> Patch as-applied is attached.

Excellent. Thanks.

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2007-02-02 02:17:51 Re: BUG #2953: index scan, feature request
Previous Message Tom Lane 2007-02-01 19:35:17 Re: BUG #2954: null is not checked against domain constraints in return clause