Re: table name restiction

Поиск
Список
Период
Сортировка
От Richard Huxton
Тема Re: table name restiction
Дата
Msg-id 41FEA697.3040609@archonet.com
обсуждение исходный текст
Ответ на table name restiction  (dale <dalen@czexan.net>)
Список pgsql-general
dale wrote:
> PostgreSQL users,
>     What are the restrictions on naming tables or columns in tables
> other than uniqueness (assuming ascii characters)?  For instance, are
> names case sensitive.  What special characters can be used
> (`_`,`-`,` `).  I looked at the docs in the tutorial part in the
> beginning and in the description of CREATE TABLE but could not find
> naming restriction info.  Could someone point me in the right direction?

As a rule of thumb, stick to all-one-case, a-z,0-9 and _
This should be portable to other database systems. SQL is case
insensitive (although the standard folds to UPPERCASE whereas PG folds
to lower). You can create a case-sensitive table by quoting but you will
need to use quotes in future too.

So this will work (because PG treats them all as "mytable"):
   CREATE TABLE MyTable
   SELECT * FROM MYTABLE
   SELECT * FROM mytable
   SELECT * FROM MyTaBlE
This will not (because the select ends up as "mytable" not "MyTable"):
   CREATE TABLE "MyTable"
   SELECT * FROM MyTable

--
   Richard Huxton
   Archonet Ltd

В списке pgsql-general по дате отправления:

Предыдущее
От: Scott Marlowe
Дата:
Сообщение: Re: postgres session termination
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Dereferencing a 2-dimensional array in plpgsql