Re: Why do we let CREATE DATABASE reassign encoding?

From: Bill Moran <wmoran(at)potentialtech(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Why do we let CREATE DATABASE reassign encoding?
Date: 2009-04-23 19:07:22
Message-ID: 20090423150722.b7d1b00f.wmoran@potentialtech.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

In response to Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:

> Bill Moran <wmoran(at)potentialtech(dot)com> writes:
> > In response to Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>:
> >> We should presumably let the encoding be changed when cloning
> >> from template0, and probably it's reasonable to trust the user
> >> if either source or destination DB encoding is SQL_ASCII.
> >> In other cases I'm thinking it should fail.
>
> > On a pedantic level, doesn't this remove the ability to have
> > databases on a single cluster that are different encodings? I mean,
> > if template1 is utf8, and I can't change that using CREATE
> > DATABASE, then I'm stuck with utf8 for all databases on that
> > cluster ... unless I'm missing something.
>
> You're supposed to clone from template0, not template1, when creating
> DBs that are different in either encoding or locale from the
> installation default. We already enforce this except for having missed
> the special case of C locale.

Ah ... was not aware of that. It hasn't come up in my usage.

> (There might be some corner cases
> involving UTF8 on Windows, too; not sure about that.) The reason is
> that template0 is expected to contain only ASCII data, but template1
> might not.

Makes sense, with that explanation.

--
Bill Moran
http://www.potentialtech.com
http://people.collaborativefusion.com/~wmoran/

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2009-04-23 19:10:17 Re: Why do we let CREATE DATABASE reassign encoding?
Previous Message Andrew Dunstan 2009-04-23 19:06:15 Re: Why do we let CREATE DATABASE reassign encoding?