Re: plperl -- postgresql married to perl - Mailing list pgsql-general

From will trillich
Subject Re: plperl -- postgresql married to perl
Date
Msg-id 20010331001328.Q31280@mail.serensoft.com
Whole thread Raw
In response to Re: plperl -- postgresql married to perl  (Soma Interesting <dfunct@telus.net>)
List pgsql-general
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?

will@serensoft.com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

pgsql-general by date:

Previous
From: will trillich
Date:
Subject: Re: dynamic field names in a function.
Next
From: will trillich
Date:
Subject: Re: function to operate on same fields, different records?