Hi,
sorry, when this is a silly question, but i wonder why the following pl/pgsql
functions works:
CREATE FUNCTION test (text) RETURNS TEXT AS '
DECLAREtable_name ALIAS FOR $1;
BEGIN-- test_table is an existing table
CREATE TEMPORARY TABLE temp1 AS SELECT * FROM test_table WHERE (hsp_rank=1 AND
hsp_evalue<=evalue_cutoff);
RETURN table_name;
END;
' LANGUAGE 'plpgsql';
and this one with the table name specified by the calling parameter not:
CREATE FUNCTION test (text) RETURNS TEXT AS '
DECLAREtable_name ALIAS FOR $1;
BEGIN
CREATE TEMPORARY TABLE temp1 AS SELECT * FROM table_name WHERE (hsp_rank=1 AND
hsp_evalue<=evalue_cutoff);
RETURN table_name;
END;
' LANGUAGE 'plpgsql';
Result:
prod2_db=#SELECT test('test_table');
ERROR: parser: parse error at or near "$1"
Any idea ?
Regards
Michael Beckstette