Re: [HACKERS] [PATCH] Generic type subscripting

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] [PATCH] Generic type subscripting
Дата
Msg-id 110031.1608233296@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] [PATCH] Generic type subscripting  (Pavel Stehule <pavel.stehule@gmail.com>)
Ответы Re: [HACKERS] [PATCH] Generic type subscripting  (Chapman Flack <chap@anastigmatix.net>)
Re: [HACKERS] [PATCH] Generic type subscripting  (Pavel Stehule <pavel.stehule@gmail.com>)
Список pgsql-hackers
Pavel Stehule <pavel.stehule@gmail.com> writes:
> čt 17. 12. 2020 v 19:49 odesílatel Tom Lane <tgl@sss.pgh.pa.us> napsal:
>> So ... what's the problem with that?  Seems like what you should put
>> in and what you should get out should be the same type.

> I don't think so.  For  XML or JSON the target can be different, and it can
> safe one CAST

> DECLARE
>   n int;
>   v varchar;
>   js jsonb default '{"n": 100, "v" : "Hello"};
> BEGIN
>   n := js['n'];
>   v := js['v'];

If you're imagining that js['n'] and js['v'] would emit different
datatypes, forget it.  That would require knowing at parse time
what the structure of the json object will be at run time.

But in any case, the discussion here is about the source datatype
for an assignment, which this example doesn't even contain.

            regards, tom lane



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

Предыдущее
От: Peter Geoghegan
Дата:
Сообщение: Re: Optimizing the documentation
Следующее
От: Dmitry Dolgov
Дата:
Сообщение: Re: [HACKERS] [PATCH] Generic type subscripting