Re: [HACKERS] Re: issue: record or row variable cannot be part of multiple-item INTO list

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: [HACKERS] Re: issue: record or row variable cannot be part of multiple-item INTO list
Дата
Msg-id 2404.1505855565@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: [HACKERS] Re: issue: record or row variable cannot be part ofmultiple-item INTO list  ("David G. Johnston" <david.g.johnston@gmail.com>)
Ответы Re: [HACKERS] Re: issue: record or row variable cannot be part ofmultiple-item INTO list  ("David G. Johnston" <david.g.johnston@gmail.com>)
Список pgsql-hackers
"David G. Johnston" <david.g.johnston@gmail.com> writes:
> Actually, this does work, just not the way one would immediately expect.

On closer inspection, what's actually happening in your example is that
you're getting the SELECT's ct1 result crammed into the first column of
c1, and then a default NULL is stuck into its second column:

> ​ct1: (text, text)​

> DO $$
> SELECT ('1', '2')::ct1 INTO c1;
> RAISE NOTICE '%', c1;
> END;
> $$;

> ​Notice: ("(1,2)",)

Notice the parens/comma positioning.  It's only because text is such
a lax datatype that you didn't notice the problem.
        regards, tom lane


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] SCRAM in the PG 10 release notes
Следующее
От: Tom Lane
Дата:
Сообщение: Re: [HACKERS] Show backtrace when tap tests fail