Обсуждение: All numeric database names?

Поиск
Список
Период
Сортировка

All numeric database names?

От
"Chris Hoover"
Дата:
Just wanted to check, are there any problems/gotcha's to having a cluster of all numeric database names?  We are thinking of switching our database naming system to use our customer number (a 6 digit integer) for the database name.  Is a negative/bad thing?

Thanks,

Chris

PG 8.1

Re: All numeric database names?

От
Steve Crawford
Дата:
Chris Hoover wrote:
> Just wanted to check, are there any problems/gotcha's to having a
> cluster of all numeric database names?  We are thinking of switching
> our database naming system to use our customer number (a 6 digit
> integer) for the database name.  Is a negative/bad thing?
Technically speaking, it will be of data type "name". You can use all
digits for the database name as you can with tables and columns (create
table "1" ("2" text);) but you may run into places where you have to
quote the name. For instance, in psql you might need to switch databases
with:

\c "123456"

instead of

\c 123456

Alternately, you could prepend 1+ alpha characters to the customer
numbers to create names like c123456 or cust123456 which don't need to
be quote-enclosed. Personally, I try to avoid reserved words and
anything else that requires special handling.

Cheers,
Steve


Re: All numeric database names?

От
Tom Lane
Дата:
Steve Crawford <scrawford@pinpointresearch.com> writes:
> Alternately, you could prepend 1+ alpha characters to the customer
> numbers to create names like c123456 or cust123456 which don't need to
> be quote-enclosed.

I'd recommend that too.  Quite aside from the quoting problem, this
will save you tons of confusion if you ever have to deal with database
OIDs (during disaster recovery perhaps).

            regards, tom lane