Re: why am I told "subquery must return only one column"

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: why am I told "subquery must return only one column"
Дата
Msg-id 749.1210006864@sss.pgh.pa.us
обсуждение исходный текст
Ответ на why am I told "subquery must return only one column"  (John Gunther <postgresql@bucksvsbytes.com>)
Ответы Re: why am I told "subquery must return only one column" (SELECTing values to be used as function arguments)
Список pgsql-novice
John Gunther <postgresql@bucksvsbytes.com> writes:
> and trying to create a second function mstr that calls the sub function
> using a select statement as sub's argument:
> create function mstr(text,text) returns int as 'select sub((select
> 5,6,7,8)::m);' language sql;

I think you want 'select sub(row(5,6,7,8)::m)'

> My question is this:
> (select 5,6,7,8)::m returns a single entity of composite type m

No, the select returns four columns, and trying to cast it after the
fact doesn't change that.  We might at some point try to support the
above syntax, but I'm not in a big hurry considering that it's not
required by the SQL spec --- the row() syntax is what the spec says
you use to construct a composite value.

            regards, tom lane

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

Предыдущее
От: John Gunther
Дата:
Сообщение: why am I told "subquery must return only one column"
Следующее
От: John Gunther
Дата:
Сообщение: Re: why am I told "subquery must return only one column" (SELECTing values to be used as function arguments)