1

I'm new on Postgresql (9.2) and I have a problem creating tables in a specified schema

When I create the same tables in the public schema it works fine but in my "test" schema it doesn't

--> ERREUR:  la relation « intervention_site » n'existe pas
--> ERROR: the relation « intervention_site » does not exist.

Maybe a right problem?

2
  • 5
    Show us full command - right now it doesn't make much sense, as table creation doesn't require any other table to exist.
    – user80168
    Feb 14, 2013 at 17:34
  • Read this: postgresql.org/docs/9.2/static/ddl-schemas.html and see if it's an issue with search_path etc. Feb 14, 2013 at 17:37

1 Answer 1

0

Chances are that the test schema is not in your search path.

You can change this by a number of methods. you can change it temporarily or for the session with:

SET search_path=test;

When you are done, you can reset:

RESET search_path;

If you want to set this as the default for a given db user:

ALTER USER foo SET search_path=test;

Or to reset:

ALTER USER foo RESET search_path;

You can also alter databases in this way.

If you want to continue to be able to check for tables in public, use a comma separated list:

SET search_path=test,public;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.