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();

While there is a default_schema property in the hibernate.cfg.xml that is set to “my_schma”, hibernate seems to only use this for schema generation, but not for queries. Is this a bug or by design?

I also added schema=”my_schma”  in the hibernate class mappings, but still no luck. Doesn’t make sense that a global schema can’t be set once and used in all mappings.

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s