Re: [SQL] Arrays in PL/pgSQL routines?

2005-12-29 Thread Michael Fuhr
On Thu, Dec 29, 2005 at 01:23:28PM -0500, Ken Winter wrote: > That works. (Odd that the initialization seems to be necessary to make it > work.) Thanks! Yes, I'm using version 7.4. 7.4.what? Absence of initialization shouldn't cause a syntax error; at least it doesn't in 7.4.10. However, in 7

Re: [SQL] Arrays in PL/pgSQL routines?

2005-12-29 Thread Tom Lane
"Ken Winter" <[EMAIL PROTECTED]> writes: > That works. (Odd that the initialization seems to be necessary to make it > work.) Thanks! Yes, I'm using version 7.4. Possibly what you're running into is that 7.4 is restrictive about what you can do with an array that's NULL. Until pretty recently,

Re: [SQL] Arrays in PL/pgSQL routines?

2005-12-29 Thread Ken Winter
: Ken Winter > Cc: PostgreSQL pg-sql list > Subject: Re: [SQL] Arrays in PL/pgSQL routines? > > Ken Winter wrote: > > Can arrays be declared in PL/pgSQL routines? If so, how? > > > > > DECLARE > > > try: > my_array VARCHAR[] := '{}'; > > no

Re: [SQL] Arrays in PL/pgSQL routines?

2005-12-29 Thread Michael Fuhr
On Thu, Dec 29, 2005 at 12:46:28PM -0500, Ken Winter wrote: > Can arrays be declared in PL/pgSQL routines? If so, how? > > Section 8.10 of the documentation > (http://www.postgresql.org/docs/7.4/static/arrays.html) tells how to declare > and use arrays as table columns. But I don't find any part

Re: [SQL] Arrays in PL/pgSQL routines?

2005-12-29 Thread Bricklen Anderson
Ken Winter wrote: Can arrays be declared in PL/pgSQL routines? If so, how? DECLARE try: my_array VARCHAR[] := '{}'; not sure if this works in 7.4 though, if that's the version that you are using. ---(end of broadcast)--- TIP 9: In versio

[SQL] Arrays in PL/pgSQL routines?

2005-12-29 Thread Ken Winter
Can arrays be declared in PL/pgSQL routines?  If so, how?   Section 8.10 of the documentation (http://www.postgresql.org/docs/7.4/static/arrays.html) tells how to declare and use arrays as table columns.  But I don’t find any part of the documentation that says how to declare a simple arr

Re: [SQL] arrays in pl/pgsql

2003-12-15 Thread Tom Lane
Michael Shapiro <[EMAIL PROTECTED]> 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 elem

[SQL] arrays in pl/pgsql

2003-12-15 Thread Michael Shapiro
Is it possible in pl/pgsql to declare and then assign to arrays? For example if I declare an array as follows DECLARE dn text[]; How do I assign the first element to a string (say 'a'). I have tried the following (which doesn't work) dn[1] := \'a\'; The parser do