Re: PostgreSQL Naming Rules

From: Craig Ringer <ringerc(at)ringerc(dot)id(dot)au>
To: Robert Buckley <robertdbuckley(at)yahoo(dot)com>
Cc: "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org>
Subject: Re: PostgreSQL Naming Rules
Date: 2011-10-29 02:17:23
Message-ID: 4EAB6233.5050808@ringerc.id.au
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Mohamed Hashim 2011-10-29 04:10:12 Re: Performance Problem with postgresql 9.03, 8GB RAM,Quadcore Processor Server--Need help!!!!!!!
Previous Message Josh Berkus 2011-10-28 21:54:12 Re: PostgreSQL at LISA in Boston: Dec. 7-8