Re: [SQL] constraint and ordered value

2005-12-29 Thread Daryl Richter
On Dec 29, 2005, at 2:16 AM, Bruno Wolff III wrote: On Wed, Dec 28, 2005 at 00:52:18 +0700, David Garamond <[EMAIL PROTECTED]> wrote: Is it possible to use only CHECK constraint (and not triggers) to completely enforce ordered value of a column (colx) in a table? By that I mean: 1. Rows

[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] constraint and ordered value

2005-12-29 Thread David Garamond
Daryl Richter wrote: >> No. A constraint only applies to one row at a time. If you try to >> work around >> this by calling a function that does queries it isn't guarenteed to >> work. >> And if you are thinking of calling a function that does a query, you >> aren't >> looking at saving time ove

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

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 Ken Winter
Bricklen ~ That works. (Odd that the initialization seems to be necessary to make it work.) Thanks! Yes, I'm using version 7.4. ~ Ken > -Original Message- > From: Bricklen Anderson [mailto:[EMAIL PROTECTED] > Sent: Thursday, December 29, 2005 12:53 PM > To: Ken Winter > Cc: PostgreSQL

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 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