Re: [GENERAL] plpgsql and arrays

2007-01-12 Thread Richard Huxton
Artis Caune wrote: Thanks a lot! Normal upper/lower loop works fine: CREATE OR REPLACE FUNCTION add_user( VARCHAR(128)[] ) RETURNS SMALLINT I'd rename the function "add_users()" AS $$ DECLARE v_uid SMALLINT; v_low SMALLINT; v_upp SMALLINT; empty BOOLEAN := TRUE; BEGIN SELECT INTO

Re: [GENERAL] plpgsql and arrays

2007-01-12 Thread Artis Caune
Thanks a lot! Normal upper/lower loop works fine: CREATE OR REPLACE FUNCTION add_user( VARCHAR(128)[] ) RETURNS SMALLINT AS $$ DECLARE v_uid SMALLINT; v_low SMALLINT; v_upp SMALLINT; empty BOOLEAN := TRUE; BEGIN SELECT INTO v_low array_lower($1,1); SELECT INTO v_upp array_upper($1,1)

Re: [GENERAL] plpgsql and arrays

2007-01-12 Thread Richard Huxton
Artis Caune wrote: I'm trying to write function which accept array and insert each element in table: =# SELECT * FROM add_user('[EMAIL PROTECTED], [EMAIL PROTECTED]'); ERROR: column "email" is of type character varying but expression is of type record HINT: You will need t

[GENERAL] plpgsql and arrays

2007-01-12 Thread Artis Caune
I'm trying to write function which accept array and insert each element in table: =# SELECT * FROM add_user('[EMAIL PROTECTED], [EMAIL PROTECTED]'); ERROR: column "email" is of type character varying but expression is of type record HINT: You will need to rewrite or cast th