Re: How does one impolement lists, or arrays, pin pl/pgsql ?

From: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
To: "Gauthier, Dave" <dave(dot)gauthier(at)intel(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How does one impolement lists, or arrays, pin pl/pgsql ?
Date: 2007-06-30 07:38:57
Message-ID: 162867790706300038nd00e21br42800d4d0edc6087@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello

PostgreSQL supports modifyable arrays. You have to respect some
specific (depend on version of postgresql). Array have to be
initialised (filled) for all pg versions older than 8.2.

create or replace function foo()
returns int as $$
declare a int[] = '{0,0,0,0,0,0,0,0,0,0}'; -- inicialisation need for
versions < 8.2.
begin a[4] := 10; a[8] := 10;
raise notice '%', a;
return a[4];
end$$ language plpgsql;

Regards
Pavel Stehule

2007/6/29, Gauthier, Dave <dave(dot)gauthier(at)intel(dot)com>:
>
>
>
>
> How does one implement a simple, general purpose, assignable array (or list)
> in pl/pgsql? From what I've found/read, it appears that you can declare
> static, read-only arrays. I'm guessing (and please correct if I'm wrong),
> PG does not support modifyable arrays. Rather, one might consider defining
> a temporary table and using sql to insert/select to/from it. True?
>
>
>
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marcus Engene 2007-06-30 08:00:47 stem & tsearch2, want different stemmed words
Previous Message Pavel Stehule 2007-06-30 07:29:23 Re: greatest/least semantics different between oracle and postgres