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

Поиск
Список
Период
Сортировка
От Bill Moran
Тема Re: Could not create a table named "USER" under
Дата
Msg-id 20040818143523.6928dbb5.wmoran@potentialtech.com
обсуждение исходный текст
Ответ на Could not create a table named "USER" under postgreSQL  (Ying Lu <ying_lu@cs.concordia.ca>)
Список 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 по дате отправления:

Предыдущее
От: George Essig
Дата:
Сообщение: Re: Installing FullTextSearchTool tsearch2
Следующее
От: Ying Lu
Дата:
Сообщение: Could not create a table named "USER" under postgreSQL