Re: [SQL] Is it normal that functions are so much faster than inline queries

2004-04-01 Thread Olivier Hubaut
On Wed, 31 Mar 2004 10:33:20 -0500, Tom Lane <[EMAIL PROTECTED]> wrote: "Olivier Hubaut" <[EMAIL PROTECTED]> writes: When I want to execute this set of queries in a function: ... It takes only 2 seconds. But when I tried to do it directly in the psql term (replacing the $1 value with the same use

[SQL] Array_append does not work with Array variables in PL/pgSQL?

2004-04-01 Thread Josh Berkus
Folks, See if you can spot any mistake I'm making here. I've declared the following array variables in a plpgsql function: v_vals TEXT[]; n_vals TEXT[]; After some manipulation, I try to synch them: n_vals := array_append(n_vals, v_vals[arrloop]); val_result := v_vals[arrloop]; RAISE NOTIC

Re: [SQL] Array_append does not work with Array variables in PL/pgSQL?

2004-04-01 Thread Joe Conway
Josh Berkus wrote: v_vals TEXT[]; n_vals TEXT[]; try: v_vals TEXT[] := ''{}''; n_vals TEXT[] := ''{}''; You have to initialize the array to something non-null, even if that be an empty array (note that there is a difference). When trying to append an element to a NULL valued array, you wind

Re: [SQL] Array_append does not work with Array variables in PL/pgSQL?

2004-04-01 Thread Joe Conway
Josh Berkus wrote: BTW, did you get my e-mail to Hackers about ARRAY[] IS NULL? I saw it, but I've been too swamped to really read it. I'll try to carve out some time this afternoon. Joe ---(end of broadcast)--- TIP 5: Have you checked our extensi

Re: [SQL] Array_append does not work with Array variables in PL/pgSQL?

2004-04-01 Thread Josh Berkus
Joe, > You have to initialize the array to something non-null, even if that be > an empty array (note that there is a difference). When trying to append > an element to a NULL valued array, you wind up with a NULL result. It is > similar to: Aha! I knew that I was missing something fundamenta

Re: [SQL] Array_append does not work with Array variables in PL/pgSQL?

2004-04-01 Thread Josh Berkus
Joe, > I saw it, but I've been too swamped to really read it. I'll try to carve > out some time this afternoon. No urgency on my part. More something to fix for 7.5 -- -Josh Berkus Aglio Database Solutions San Francisco ---(end of broadcast)---

Re: [SQL] [pgsql-advocacy] SQL Spec Compliance Questions

2004-04-01 Thread Joe Conway
Josh Berkus wrote: 6) SQL-99 Distinct Types 7) SQL-99 Structured Types 9) SQL-99 Collection Types 10) SQL-99 Typed tables and views My answers: 6), 7) Not sure what these are. Here's the section in SQL99: 4.8 User-defined types A user-defined type is a schema object, identified by a