I even found another way of doing it, since Postgres 9.1 you it is possible
to use "execute format" which seems a little easier to use than the method
with the string concatenation parameters:
CREATE OR REPLACE FUNCTION trigger_function1() RETURNS trigger AS
$$ begin execute format(' select table2.id from %I.table2 where value1=%L
', TG_TABLE_SCHEMA, new.value1) using new into new.id; return new;
end:
$$
language plpgsql;
"%I" replaces the quote_ident method and "%L" the quote_literal method.
--
View this message in context:
http://postgresql.1045698.n5.nabble.com/SOLVED-Trigger-function-variable-for-schema-name-tp5788931p5792154.html
Sent from the PostgreSQL - sql mailing list archive at Nabble.com.