Re: creating "user" table - Mailing list pgsql-general

From Mike Mascari
Subject Re: creating "user" table
Date
Msg-id 3BAE6DFA.D0B78BC3@mascari.com
Whole thread Raw
In response to Re: creating "user" table  (Chris <csmith@squiz.net>)
List pgsql-general
Chris wrote:
>
> Hey,
...
>
> > > False precondition!
> > >
> > >     template1=# create database demo;
> > >     CREATE DATABASE
> > >     template1=# \c demo
> > >     You are now connected to database demo.
> > >     demo=# create table "user" (name text, age int);
...
>
> True, didn't give that example, but.. try that in another DBMS :) I know
> (at least) MySQL won't let you do that (*waits for the obvious comment*),
> don't know about other DBMS needing quotes around the name, but I don't
> think that one is portable to other systems :/

Its at least portable to Oracle, which behaves the same way as
PostgreSQL, BTW:

Connected to:
Oracle8 Enterprise Edition Release 8.0.5.0.0 - Production
PL/SQL Release 8.0.5.0.0 - Production

SQL> CREATE TABLE USER (key INTEGER);
CREATE TABLE USER (key INTEGER)
             *
ERROR at line 1:
ORA-00903: invalid table name


SQL> CREATE TABLE "user" (key INTEGER);

Table created.

>
> As Jochem pointed out in another post, by definition it's a reserved word
> (both sql92 & 99) so I'll go back to my corner again :)

Mike Mascari
mascarm@mascari.com

pgsql-general by date:

Previous
From: missive@frontiernet.net (Lee Harr)
Date:
Subject: Re: My brain hurts - update field based on value of another table's field
Next
From: R Talbot
Date:
Subject: Re: Where are Perl DBI and DBD for PostgreSQL??