On Fri, Mar 30, 2001 at 06:02:27PM -0800, Soma Interesting wrote:
> At 06:47 PM 3/30/2001 -0600, you wrote:
> > > I may be able to use array's if postgres will allow using variables to
> > > reference points in the array.
> 
> 
> OK, so how do I reference a specific element of an array in a record within 
> pl/pgsql.
> 
> I've tried:
> 
> NEW.name[1]
> NEW.name.1

hmm. maybe it's NEW that's the problem...?


        create table gunk(
                val varchar[]
        );

        insert into gunk
        values (
                '{"first string","another value","the end"}'
        ) ;

        select val[2] from gunk;

                  val      
        ---------------
         another value
        (1 row)

i'd think

        table.field[index]

should do the trick, even in plpgsql:

        myvar := select name[index] from new;

        myvar := new.name[somevariable];

        myary := new.name;
        myvar := myary[someindexvar];

no? (unless <guess> maybe the plpgsql compiler doesn't like
variable subscript values </guess>, which would warrant keel
hauling everyone responsible...)

-- 
does a brain cell think?

[EMAIL PROTECTED]
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

---------------------------(end of broadcast)---------------------------
TIP 4: Don't 'kill -9' the postmaster

Reply via email to