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