Re: Why do we let CREATE DATABASE reassign encoding? - Mailing list pgsql-hackers

From Heikki Linnakangas
Subject Re: Why do we let CREATE DATABASE reassign encoding?
Date
Msg-id 49F0B95C.20005@enterprisedb.com
Whole thread Raw
In response to Re: Why do we let CREATE DATABASE reassign encoding?  (Bill Moran <wmoran@potentialtech.com>)
List pgsql-hackers
Bill Moran wrote:
> In response to Tom Lane <tgl@sss.pgh.pa.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


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: Why do we let CREATE DATABASE reassign encoding?
Next
From: Tom Lane
Date:
Subject: Re: Why do we let CREATE DATABASE reassign encoding?