Re: Could not create a table named "USER" under - Mailing list pgsql-general

From Bill Moran
Subject Re: Could not create a table named "USER" under
Date
Msg-id 20040818143523.6928dbb5.wmoran@potentialtech.com
Whole thread Raw
In response to Could not create a table named "USER" under postgreSQL  (Ying Lu <ying_lu@cs.concordia.ca>)
List pgsql-general
Ying Lu <ying_lu@cs.concordia.ca> wrote:

> Hello,
>
> I have a table named "USER" under MySQL database. When I am trying to
> move tables from MySQL to PostgreSQL, I found that I could not create a
> table namely "USER". I guess "USER" is a key string used by PostgreSQL
> system so that we could not create a table named "USER". Is that true?

Yes and no.

"user" is a SQL reserved word, which means _no_ SQL database _should_ let
you create a table by that name.

However, if you acutally enclose the name in quotes, you can safely work
around that restriction, i.e.:

CREATE TABLE "USER" AS ...

Be warned that when you enclose the table name in quotes, it becomes
case-sensitive, thus you will have to enclose it in quotes every time
you use it or the names won't match.

A better solution would be to take this opportunity to make your table
names more SQL compliant.

HTH.

--
Bill Moran
Potential Technologies
http://www.potentialtech.com

pgsql-general by date:

Previous
From: George Essig
Date:
Subject: Re: Installing FullTextSearchTool tsearch2
Next
From: Ying Lu
Date:
Subject: Could not create a table named "USER" under postgreSQL