Re: Why does to_json take "anyelement" rather than "any"?

Поиск
Список
Период
Сортировка
От Nikhil Benesch
Тема Re: Why does to_json take "anyelement" rather than "any"?
Дата
Msg-id 7921c7e1-85dd-c27e-f933-069fd7e8fd0f@gmail.com
обсуждение исходный текст
Ответ на Re: Why does to_json take "anyelement" rather than "any"?  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: Why does to_json take "anyelement" rather than "any"?
Список 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
rulesof polymorphism apply when performing a lookup.  My uninformed conclusion is that since to_json only defines a
singleparameter 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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Masahiro Ikeda
Дата:
Сообщение: Re: Add statistics to pg_stat_wal view for wal related parameter tuning
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Why does to_json take "anyelement" rather than "any"?