From: | Nikhil Benesch <nikhil(dot)benesch(at)gmail(dot)com> |
---|---|
To: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, Mohamed Wael Khobalatte <mkhobalatte(at)grubhub(dot)com> |
Cc: | PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Why does to_json take "anyelement" rather than "any"? |
Date: | 2020-11-06 01:45:37 |
Message-ID: | 7921c7e1-85dd-c27e-f933-069fd7e8fd0f@gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 11/5/20 7:38 PM, David G. Johnston wrote:
> My understanding is that "any" is defined to accept that behavior - allowing any pseudo-type and unknown. The "anyelement" polymorphic pseudo-type is defined such that only concrete known types are allowed to match - and then the rules of polymorphism apply when performing a lookup. My uninformed conclusion is that since to_json only defines a single parameter that changing it from "anyelement" to "any" would be reasonable and the hack describe probably "just works" (though I'd test it on a wide-range of built-in types first if I was actually going to use the hack).
>
> You only get to use "any" for a C-language function but that is indeed the case here.
That exactly matches my understanding as well. I'll put together a patch.
Nikhil
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2020-11-06 01:58:57 | Re: Why does to_json take "anyelement" rather than "any"? |
Previous Message | Masahiro Ikeda | 2020-11-06 01:25:07 | Re: Add statistics to pg_stat_wal view for wal related parameter tuning |