Search Postgresql Archives

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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 supposed to 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't return 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!



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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux