BUG #14200: Cannot create a table named 'user'
The following bug has been logged on the website:
Bug reference: 14200
Logged by: Matthew Di Pasquale
Email address: liveloveprosper@gmail.com
PostgreSQL version: 9.5.3
Operating system: OS X 10.11.5
Description:
Problem:
http://stackoverflow.com/q/22256124
Why doesn't the user table have the pg_ prefix or some other prefix?
What if I want to create a user table for my application? Shouldn't I be
able to call that table user?
Would the only reason to use table name prefixes be to avoid this
conflict?
http://stackoverflow.com/questions/324163/should-we-use-prefixes-in-our-database-table-naming-conventions#comment61629636_324183
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
On Saturday, June 18, 2016, <liveloveprosper@gmail.com> wrote:
The following bug has been logged on the website:
Bug reference: 14200
Logged by: Matthew Di Pasquale
Email address: liveloveprosper@gmail.com <javascript:;>
PostgreSQL version: 9.5.3
Operating system: OS X 10.11.5
Description:
Not a bug.
And it was asked and answered, correctly, two years ago.
Why doesn't the user table have the pg_ prefix or some other prefix?
You should read that SO post again...
It does. Check the docs for proof. Or just try <select * from user> in
newly created database. Then try <select * from pg_user>.
What if I want to create a user table for my application? Shouldn't I be
able to call that table user?
If you quote it you can. But as the SO answer advises just live with the
fact it's not a recommended approach.
Would the only reason to use table name prefixes be to avoid this
conflict?
Don't know what you are asking for here...
David J.
"David G. Johnston" <david.g.johnston@gmail.com> writes:
On Saturday, June 18, 2016, <liveloveprosper@gmail.com> wrote:
What if I want to create a user table for my application? Shouldn't I be
able to call that table user?
If you quote it you can.
Worth noting here is that USER is a reserved word according to the
SQL standard, as well as our documentation:
https://www.postgresql.org/docs/9.5/static/sql-keywords-appendix.html
You should not be surprised that you can't use it as a generic identifier
without adding quotes.
(The only reason it's reserved in Postgres is to implement the
spec-defined meaning of the keyword. I can't imagine that we'd have
chosen to reserve it without that requirement.)
regards, tom lane
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs