Re: remaining sql/json patches

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: remaining sql/json patches
Дата
Msg-id 9cc84ac3-a56d-0d5f-59df-215f7794aec0@dunslane.net
обсуждение исходный текст
Ответ на Re: remaining sql/json patches  (Amit Langote <amitlangote09@gmail.com>)
Ответы Re: remaining sql/json patches  (Amit Langote <amitlangote09@gmail.com>)
Список pgsql-hackers


On 2023-09-19 Tu 23:07, Amit Langote wrote:
On Tue, Sep 19, 2023 at 9:00 PM Amit Langote <amitlangote09@gmail.com> wrote:
On Tue, Sep 19, 2023 at 7:37 PM jian he <jian.universality@gmail.com> wrote:
 -------------------
https://www.postgresql.org/docs/current/extend-type-system.html#EXTEND-TYPES-POLYMORPHIC
 When the return value of a function is declared as a polymorphic type, there must be at least one argument position that is also
polymorphic, and the actual data type(s) supplied for the polymorphic arguments determine the actual result type for that call.
select json_query(jsonb'{"a":[{"a":[2,3]},{"a":[4,5]}]}','$.a[*].a?(@<=3)'
returning anyrange);
should fail. Now it returns NULL. Maybe we can validate it in
transformJsonFuncExpr?
-------------------
I'm not sure whether we should make the parser complain about the
weird types being specified in RETURNING.
Sleeping over this, maybe adding the following to
transformJsonOutput() does make sense?

+   if (get_typtype(ret->typid) == TYPTYPE_PSEUDO)
+       ereport(ERROR,
+               errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
+               errmsg("returning pseudo-types is not supported in
SQL/JSON functions"));
+


Seems reasonable.


cheers


andrew


--
Andrew Dunstan
EDB: https://www.enterprisedb.com

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

Предыдущее
От: Nathan Bossart
Дата:
Сообщение: Re: should frontend tools use syncfs() ?
Следующее
От: Nathan Bossart
Дата:
Сообщение: Re: Add 'worker_type' to pg_stat_subscription