Re: plperl -- postgresql married to perl

From: will trillich <will(at)serensoft(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: plperl -- postgresql married to perl
Date: 2001-03-31 06:13:28
Message-ID: 20010331001328.Q31280@mail.serensoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)serensoft(dot)com
http://sourceforge.net/projects/newbiedoc -- we need your brain!
http://www.dontUthink.com/ -- your brain needs us!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message will trillich 2001-03-31 06:17:46 Re: function to operate on same fields, different records?
Previous Message will trillich 2001-03-31 06:05:08 Re: dynamic field names in a function.