Bestfoodnearme.com
Bestfoodnearme.com

Reputation: 291

a table with same name as user system table in postgresl

I have a table in my database named the same as the system table "user" I cannot figure out how to set the environment so that I select from my "user" table and not the system table as the postgres user. I have tried

SET SCHEMA 'myschema';

and also at the psql connection line

PGOPTIONS=--search_path=myschema psql -U postgres -d mydatabase

but these have not worked. I still have to prefix my table as

myschema.user when I execute sql commands in psql.

Is there a way to set the environment so that it will default to my "user" table?

Upvotes: 1

Views: 657

Answers (1)

Milen A. Radev
Milen A. Radev

Reputation: 62593

There's no system table called "user". "user" is a reserved word and a system information function on top of this.

All reserved words could be used for identifiers, but have to be quoted.

Upvotes: 3

Related Questions