Re: Why do we let CREATE DATABASE reassign encoding?

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(dot)com>
To: Bill Moran <wmoran(at)potentialtech(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Why do we let CREATE DATABASE reassign encoding?
Date: 2009-04-23 18:54:20
Message-ID: 49F0B95C.20005@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Bill Moran wrote:
> 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 could still use template0 as template for a database with any
encoding, like:

CREATE DATABASE .. TEMPLATE = template0;

We can special case template0 because we know its contents are pure
7-bit ascii which is compatible with any server encoding.

--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.com

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2009-04-23 18:59:52 Re: Why do we let CREATE DATABASE reassign encoding?
Previous Message Tom Lane 2009-04-23 18:52:57 Re: Why do we let CREATE DATABASE reassign encoding?