| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
|---|---|
| To: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
| Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
| Subject: | Re: Allow specifying NULL default in pg_proc.dat for "any" arguments |
| Date: | 2026-03-06 16:53:16 |
| Message-ID: | 304566.1772815996@sss.pgh.pa.us |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-hackers |
Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> On 2026-03-06 Fr 11:01 AM, Tom Lane wrote:
>> If we need a TypInfo[] entry for ANY, let's just add it.
>> But I haven't seen any use cases?
> Well, I guess that raises the question of what we get if we now do
> CREATE OR REPLACE FUNCTION foo(x int, VARIADIC y "any" DEFAULT NULL);
> which is the use case I was trying to avoid :-)
> Turns out it sets the type to "unknown" and the constlen to -2.
Hmm. Not sure if that matters or not. In any case, my objection
to the proposed patch was its side-effects on defaults that are of
regular data types. I don't think we want to change that behavior.
What exactly would be the use case for a default like the above?
I can see the point of, say, trying to merge the two variants of
jsonb_build_array:
CREATE FUNCTION pg_catalog.jsonb_build_array(VARIADIC "any") ...
CREATE FUNCTION pg_catalog.jsonb_build_array() ...
but introducing a default wouldn't help us do that, because it'd
still end up looking like a 1-argument call not a no-argument call.
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Manni Wood | 2026-03-06 16:59:52 | Re: Speed up COPY FROM text/CSV parsing using SIMD |
| Previous Message | Heikki Linnakangas | 2026-03-06 16:49:22 | Re: Rework SLRU I/O errors handle |