pgplsql and arrays - Mailing list pgsql-general

From Dan Str
Subject pgplsql and arrays
Date
Msg-id 7de955570802201017r5004305av8d3fd413d97ff7@mail.gmail.com
Whole thread Raw
List 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

pgsql-general by date:

Previous
From: "Postgres User"
Date:
Subject: Re: Regex query not using index
Next
From: "Kynn Jones"
Date:
Subject: Vacuous errors in pg_dump ... | pg_restore pipeline