From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | Michael Shapiro <mshapiro(at)ncsa(dot)uiuc(dot)edu> |
Cc: | pgsql-sql(at)postgresql(dot)org |
Subject: | Re: arrays in pl/pgsql |
Date: | 2003-12-16 03:55:38 |
Message-ID: | 18350.1071546938@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Michael Shapiro <mshapiro(at)ncsa(dot)uiuc(dot)edu> writes:
> I have tried the following (which doesn't work)
> dn[1] := \'a\';
> The parser doesn't like the [ that follows dn.
I believe Joe Conway fixed this in 7.4. Note that you also need to
initialize the array to something, because assigning to an element
of a NULL array still yields a NULL array result. For example:
regression=# create or replace function foo() returns text as '
regression'# declare dn text[] := \'{}\';
regression'# begin
regression'# dn[1] := \'a\';
regression'# return dn[1];
regression'# end' language plpgsql;
CREATE FUNCTION
regression=# select foo();
foo
-----
a
(1 row)
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | Olivier Hubaut | 2003-12-16 09:27:54 | Re: dump and schema |
Previous Message | Bruno Wolff III | 2003-12-15 19:28:47 | Re: NOT-IN CLAUSE |