Re: Could not create a table named "USER" under

From: Bill Moran <wmoran(at)potentialtech(dot)com>
To: Ying Lu <ying_lu(at)cs(dot)concordia(dot)ca>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Could not create a table named "USER" under
Date: 2004-08-18 18:35:23
Message-ID: 20040818143523.6928dbb5.wmoran@potentialtech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ying Lu <ying_lu(at)cs(dot)concordia(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Ying Lu 2004-08-18 18:36:00 Could not create a table named "USER" under postgreSQL
Previous Message George Essig 2004-08-18 18:34:16 Re: Installing FullTextSearchTool tsearch2