pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
BUG #14200: Cannot create a table named 'user'
3+ messages / 3 participants
[nested] [flat]

* BUG #14200: Cannot create a table named 'user'
@ 2016-06-19 02:58 liveloveprosper@gmail.com
  2016-06-19 04:01 ` Re: BUG #14200: Cannot create a table named 'user' David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: liveloveprosper@gmail.com @ 2016-06-19 02:58 UTC (permalink / raw)
  To: pgsql-bugs

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-conven...


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs


^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #14200: Cannot create a table named 'user'
  2016-06-19 02:58 BUG #14200: Cannot create a table named 'user' liveloveprosper@gmail.com
@ 2016-06-19 04:01 ` David G. Johnston <david.g.johnston@gmail.com>
  2016-06-19 04:53   ` Re: BUG #14200: Cannot create a table named 'user' Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 3+ messages in thread

From: David G. Johnston @ 2016-06-19 04:01 UTC (permalink / raw)
  To: liveloveprosper@gmail.com <liveloveprosper@gmail.com>; +Cc: 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:
>
> Problem:
> http://stackoverflow.com/q/22256124


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?
>
> http://stackoverflow.com/questions/324163/should-we-use-prefixes-in-our-database-table-naming-conven...
>
>
Don't know what you are asking for here...

David J.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: BUG #14200: Cannot create a table named 'user'
  2016-06-19 02:58 BUG #14200: Cannot create a table named 'user' liveloveprosper@gmail.com
  2016-06-19 04:01 ` Re: BUG #14200: Cannot create a table named 'user' David G. Johnston <david.g.johnston@gmail.com>
@ 2016-06-19 04:53   ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 3+ messages in thread

From: Tom Lane @ 2016-06-19 04:53 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: liveloveprosper@gmail.com <liveloveprosper@gmail.com>; pgsql-bugs

"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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2016-06-19 04:53 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-06-19 02:58 BUG #14200: Cannot create a table named 'user' liveloveprosper@gmail.com
2016-06-19 04:01 ` David G. Johnston <david.g.johnston@gmail.com>
2016-06-19 04:53   ` Tom Lane <tgl@sss.pgh.pa.us>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox