Multiple character encodings within a single database/table?

Started by Dann Corbitabout 17 years ago4 messagesgeneral
Jump to latest
#1Dann Corbit
DCorbit@connx.com

If I have the C locale, can I have multiple character encodings within:
1. A single database?
2. A single table?

More specifically, I would like to be able to have Unicode columns and
ASCII text columns within the same table. Is this possible? If so, how
do I achieve it?

It was not clear to me from:
http://www.postgresql.org/docs/current/static/multibyte.html

It seems to me from this statement:
"It can be overridden when you create a database, so you can have
multiple databases each with a different character set."
That it may be database wide, but I am not sure that it is not possible
to have both ordinary char and Unicode in the same table.

Possible or not?

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Dann Corbit (#1)
Re: Multiple character encodings within a single database/table?

"Dann Corbit" <DCorbit@connx.com> writes:

If I have the C locale, can I have multiple character encodings within:
1. A single database?
2. A single table?

No.

regards, tom lane

#3Steve Atkins
steve@blighty.com
In reply to: Dann Corbit (#1)
Re: Multiple character encodings within a single database/table?

On Mar 23, 2009, at 3:50 PM, Dann Corbit wrote:

If I have the C locale, can I have multiple character encodings
within:
1. A single database?
2. A single table?

No.

More specifically, I would like to be able to have Unicode columns and
ASCII text columns within the same table. Is this possible? If so,
how
do I achieve it?

Any valid ascii string is also a valid utf8 string. You can probably
just use utf8 for everything.

Cheers,
Steve

#4Bruce Momjian
bruce@momjian.us
In reply to: Steve Atkins (#3)
Re: Multiple character encodings within a single database/table?

Steve Atkins wrote:

On Mar 23, 2009, at 3:50 PM, Dann Corbit wrote:

If I have the C locale, can I have multiple character encodings
within:
1. A single database?
2. A single table?

No.

More specifically, I would like to be able to have Unicode columns and
ASCII text columns within the same table. Is this possible? If so,
how
do I achieve it?

Any valid ascii string is also a valid utf8 string. You can probably
just use utf8 for everything.

More specifically, ASCII bytes are valid UTF8 values.

--
Bruce Momjian <bruce@momjian.us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +