Re: Parameter NOT NULL to CREATE DOMAIN not the same as CHECK (VALUE IS NOT NULL)

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: jbe-mlist(at)magnetkern(dot)de, PostgreSQL-development <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Parameter NOT NULL to CREATE DOMAIN not the same as CHECK (VALUE IS NOT NULL)
Date: 2025-01-30 13:26:54
Message-ID: Z5t-HtfrECeNegGZ@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs pgsql-hackers

On Wed, Jan 8, 2025 at 04:24:34PM -0500, Tom Lane wrote:
> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > I think this needs some serious research.
>
> We've discussed this topic before. The spec's definition of IS [NOT]
> NULL for composite values is bizarre to say the least. I think
> there's been an intentional choice to keep most NOT NULL checks
> "simple", that is we look at the overall value's isnull bit and
> don't probe any deeper than that.
>
> If the optimizations added in v17 changed existing behavior,
> I agree that's bad. We should probably fix it so that those
> are only applied when argisrow is false.

I have developed the attached patch using your argisrow suggestion which
fixes the test I posted. Is this something we should backpatch?

--
Bruce Momjian <bruce(at)momjian(dot)us> https://momjian.us
EDB https://enterprisedb.com

Do not let urgent matters crowd out time for investment in the future.

Attachment Content-Type Size
domain.diff text/x-diff 1.7 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Borisov 2025-01-30 13:39:53 Re: Optimization for lower(), upper(), casefold() functions.
Previous Message Andrey Borodin 2025-01-30 13:26:29 Re: Compression of bigger WAL records

Browse pgsql-docs by date

  From Date Subject
Previous Message Tom Lane 2025-01-27 14:36:49 Re: timestamp with time zone ~> GMT