Re: BUG #2948: default null values for not-null domains - Mailing list pgsql-bugs

From Sergiy Vyshnevetskiy
Subject Re: BUG #2948: default null values for not-null domains
Date
Msg-id Pine.LNX.4.64.0702012234230.22446@uanet.vostok.net
Whole thread Raw
In response to Re: BUG #2948: default null values for not-null domains  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-bugs
On Thu, 1 Feb 2007, Tom Lane wrote:

> Sergiy Vyshnevetskiy <serg@vostok.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.

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #2954: null is not checked against domain constraints in return clause
Next
From: "Jessica"
Date:
Subject: BUG #2952: where is the user guide