Re: cannot assign non-composite value to a row variable

Поиск
Список
Период
Сортировка
От Alban Hertroys
Тема Re: cannot assign non-composite value to a row variable
Дата
Msg-id C81A95C5-DA10-4246-A377-21E5781432D8@solfertje.student.utwente.nl
обсуждение исходный текст
Ответ на cannot assign non-composite value to a row variable  (Eliot Gable <egable+pgsql-general@gmail.com>)
Ответы Re: cannot assign non-composite value to a row variable  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-general
On 4 Jun 2010, at 15:37, Eliot Gable wrote:

> CREATE OR REPLACE blah ...
> ...
> DECLARE
>   myvariable complex1[];
>   mydatasource complex1;
>   myrowsource complex2[];
> ...
> BEGIN
> ...
>   -- The first way I tried to do it:
>   myvariable := array(
>     SELECT mydatasource FROM unnest(myrowsource)
>   );

I don't see what you're trying to do here; apparently myrowsource has a column named mydatasource, but how is PG
supposedto know which mydatasource you mean - the declared one or the one from mydatasource? The same goes for
myrowsource.
I'm pretty sure you have a naming conflict.

Or did you intend to write:
    myvariable := array(unnest(myrowsource));

That probably still doesn't work. I have no installation of 8.4 at my disposal atm, so I can't verify, but IIRC unnest
doesn'treturn an array, but something else. You probably need to cast it to the right type first. 

> Each of these gives the same error message:
>
> CONTEXT: ERROR
> CODE: 42804
> MESSAGE: cannot assign non-composite value to a row variable

Alban Hertroys

--
Screwing up is an excellent way to attach something to the ceiling.


!DSPAM:737,4c0908b610152006515388!



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

Предыдущее
От: Eliot Gable
Дата:
Сообщение: cannot assign non-composite value to a row variable
Следующее
От: "Rob Richardson"
Дата:
Сообщение: How can I run an external program from a stored procedure?