7.08.2011

postgres create trigger error relation does not exist 42P01

PostgreSQL 8.4: When attempting to create a simple trigger the executes a function, for a table that exists, I was getting a 42P01 error: relation "table_name" does not exist

CREATE TRIGGER genUuid
BEFORE INSERT ON table_name
FOR EACH ROW EXECUTE PROCEDURE generate_function_v1();

This was simple resolved by including the schema name along with the table as follows:

CREATE TRIGGER genUuid
BEFORE INSERT ON my_schma.table_name
FOR EACH ROW EXECUTE PROCEDURE generate_function_v1();

No comments: