[GENERAL] recursive execute

2009-06-05 Thread Rastislav Hudak
Hi, I'd like to get an array containing distinct values (always integers) form a column in a table that is provided as a parameter. So I created this function: CREATE OR REPLACE FUNCTION get_distinct_values(table_name text, param_name text) RETURNS integer[] AS $BODY$ DECLARE _values integer[];

Re: [GENERAL] recursive execute

2009-06-05 Thread Albe Laurenz
Rastislav Hudak wrote: > I'd like to get an array containing distinct values (always > integers) form a column in a table that is provided as a > parameter. So I created this function: > > CREATE OR REPLACE FUNCTION get_distinct_values(table_name text, param_name > text) > RETURNS integer[] A

Re: [GENERAL] recursive execute

2009-06-04 Thread Rastislav Hudak
Ok mea maxima culpa I forgot to add an important fact: the table I'm putting to get_distinct_values(..) in the recursive call is a table that has just been created in the caller function (by EXECUTE 'CREATE TABLE ' || table_name_new || '...). In the first run, the get_distinct_values(..) obtains a

[GENERAL] recursive execute

2009-06-04 Thread Rastislav Hudak
Hi, I'd like to get an array containing distinct values (always integers) form a column in a table that is provided as a parameter. So I created this function: CREATE OR REPLACE FUNCTION get_distinct_values(table_name text, param_name text) RETURNS integer[] AS $BODY$ DECLARE _values integer[];