Re: preptlist.c can insert unprocessed expression trees
Sami Imseih <samimseih@gmail.com>
From: Sami Imseih <samimseih@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-hackers@lists.postgresql.org
Date: 2025-01-29T21:14:01Z
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
Commits
-
Require callers of coerce_to_domain() to supply base type/typmod.
- ba0da16bd054 18.0 landed
-
Handle default NULL insertion a little better.
- c05268e6ec93 14.16 landed
- bb85d0935583 15.11 landed
- 6e41e9e5e0de 17.3 landed
- 6655d931c659 16.7 landed
- 0da39aa7667b 18.0 landed