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!