Re: preptlist.c can insert unprocessed expression trees

From: Sami Imseih <samimseih(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: preptlist.c can insert unprocessed expression trees
Date: 2025-01-29 21:14:01
Message-ID: CAA5RZ0tb8+4ryMV_0453o+4BVptLTaKBrWR2aJ8+sYjEnOxJNw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

> to a varchar length-checking function and then to CoerceToDomain.
> Of course they really ought to look the same.

+1. I confirmed this as well with the supplied test case.

> In the attached 0001 patch I called it
> coerce_null_to_domain and put it in parse_coerce.c.

I do think the name of the function is a bit misleading.
coerce_null_to_domain could optionally coerce to a domain if
typid != baseTypeId, but not necessarily.

From what I can tell, the coerce_null_to_domain function will be
called anytime an implicit NULL is supplied to an INSERT or
UPDATE and the target column does not have a default;
so maybe it should be called coerce_implicit_null ?

> (The caller has
> to produce an input that's of the base type, after all.) So it seems
> like that's not a convenience so much as an encouragement to incorrect
> coding. I propose, for HEAD only, 0002 which removes that misfeature
> and requires callers to supply the info.

This makes sense.

check-world passed with both patches applied.

Regards,

Sami

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Melanie Plageman 2025-01-29 21:38:31 Re: BitmapHeapScan streaming read user and prelim refactoring
Previous Message Alexander Borisov 2025-01-29 20:52:59 Re: Optimization for lower(), upper(), casefold() functions.