From: Mike Rylander Date: Fri, 20 Mar 2009 14:55:47 +0000 (+0000) Subject: use a loop to get the output of an EXECUTE X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=commitdiff_plain;h=21c2a7d6334e18a69daaca0897d94843e289e78b use a loop to get the output of an EXECUTE --- diff --git a/sql/base/base_migration_schema_procs.sql b/sql/base/base_migration_schema_procs.sql index 391e83e..ae20943 100644 --- a/sql/base/base_migration_schema_procs.sql +++ b/sql/base/base_migration_schema_procs.sql @@ -22,8 +22,13 @@ INSERT INTO migration_tools.config (key,value) VALUES ( 'production_tables', 'as CREATE OR REPLACE FUNCTION migration_tools.production_tables (TEXT) RETURNS TEXT[] AS $$ DECLARE migration_schema ALIAS FOR $1; + output RECORD; BEGIN - EXECUTE 'SELECT string_to_array(value,'','') FROM ' || migration_schema || '.config WHERE key = ''production_tables'';'; + FOR output IN + EXECUTE 'SELECT string_to_array(value,'','') AS tables FROM ' || migration_schema || '.config WHERE key = ''production_tables'';' + LOOP + RETURN output.tables; + END; END; $$ LANGUAGE PLPGSQL STRICT STABLE;