Re: preptlist.c can insert unprocessed expression trees - Mailing list pgsql-hackers

From Sami Imseih
Subject Re: preptlist.c can insert unprocessed expression trees
Date
Msg-id CAA5RZ0tb8+4ryMV_0453o+4BVptLTaKBrWR2aJ8+sYjEnOxJNw@mail.gmail.com
Whole thread Raw
In response to preptlist.c can insert unprocessed expression trees  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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



pgsql-hackers by date:

Previous
From: Alexander Borisov
Date:
Subject: Re: Optimization for lower(), upper(), casefold() functions.
Next
From: Sami Imseih
Date:
Subject: Re: Sample rate added to pg_stat_statements