pgplsql and arrays

From: "Dan Str" <strd911(at)gmail(dot)com>
To: pgsql-general(at)postgresql(dot)org
Subject: pgplsql and arrays
Date: 2008-02-20 18:17:00
Message-ID: 7de955570802201017r5004305av8d3fd413d97ff7@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi List !

I have a problem with defining an array in pl/pgsql using an already defined
column in a table.
Is it possible to define an array ( v_var1 ) as in my example below:

If it is not possible now it would be really nice to have in a future
release , maybe something for 8.4 wishlist ?

create table test1
(
test_id int not null,
amount int not null,
constraint pk_test_id primary key (test_id)
);

create or replace function
test1_func( t_id test1.test_id%TYPE )
returns int as $$
declare
v_var1 test1.amount%TYPE[];
-- v_var1 int[];
v_var2 test1.amount%TYPE;
begin
v_var1[1] := 1;
v_var2 := 1;
return 1;
end;
$$ language plpgsql;

Best Regards
DS

Browse pgsql-general by date

  From Date Subject
Next Message Kynn Jones 2008-02-20 19:02:14 Vacuous errors in pg_dump ... | pg_restore pipeline
Previous Message intelforum 2008-02-20 17:25:41 Re: Using sequences in SQL text files