Re: PostgreSQL Naming Rules - Mailing list pgsql-general

From Craig Ringer
Subject Re: PostgreSQL Naming Rules
Date
Msg-id 4EAB6233.5050808@ringerc.id.au
Whole thread Raw
In response to PostgreSQL Naming Rules  (Robert Buckley <robertdbuckley@yahoo.com>)
List pgsql-general
On 10/28/2011 06:49 PM, Robert Buckley wrote:

> according to this article
> http://www.informit.com/articles/article.aspx?p=409471, the naming of
> tables, and fields is restricted to 63 characters and must start with an
> underscore or letter. Nothing is however said about in which character set.
>
> Am I allowed to name a table field < Änderung_1 >. The Ä is a german
> letter contained within the UTF8 character set.

It'll work, but sadly you will at some point run into badly written
tools that mangle anything but 7-bit-ascii text.

psql on the Windows command line needs some extra love to behave
correctly; you may have to issue a chcp command to change the console to
unicode before starting psql if you're working with data that cannot be
represented in the charset your version of Windows uses. That won't be
an issue for umlauts etc, but if you wanted (say) hebrew table names on
a German windows you'd probably have to change the codepage.

Other than that, PostgreSQL and its tools should be fine. You are likely
to run into badly written tools elsewhere that mangle anything that
isn't 7-bit ascii, though, so be careful.

In general, if PostgreSQL doesn't like a table identifier you can
"double quote" it to get it to accept it. Table identifiers in
double-quotes also have their case preserved rather than automatically
being lower-cased like unquoted identifiers. Because the downcasing
rules for anything except 7-bit ascii are less than clear, I'd recommend
double-quoting all identifiers that use characters outside that range.

--
Craig Ringer

pgsql-general by date:

Previous
From: aperi2007
Date:
Subject: Re: PG 9.1.1 - availability of xslt_process()
Next
From: Arvind Singh
Date:
Subject: question related to pg_stat_database