Skip site navigation (1) Skip section navigation (2)

Re: Why do we let CREATE DATABASE reassign encoding?

From: Heikki Linnakangas <heikki(dot)linnakangas(at)enterprisedb(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 18:09:25
Message-ID: 49F0AED5.3080908@enterprisedb.com (view raw or flat)
Thread:
Lists: pgsql-hackers
Tom Lane wrote:
> If I have locale set to C, I can do this:
> 
> regression=# create database u8 encoding 'utf8';
> CREATE DATABASE
> regression=# create database l1 encoding 'latin1' template u8;
> CREATE DATABASE
> 
> Had I had any actual utf8 data in u8, l1 would now contain
> encoding-corrupt information.  Given that we've tried to
> clamp down on encoding violations in recent releases, I wonder
> why this case is still allowed.

Wow, I'm surprised we allow that. Never occurred to me to try.

> 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.

Agreed, that's exactly what we did with per-database collation.

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

In response to

pgsql-hackers by date

Next:From: Zdenek KotalaDate: 2009-04-23 18:14:19
Subject: Re: PL compilations ignores LDFLAGS
Previous:From: Tom LaneDate: 2009-04-23 17:46:41
Subject: Why do we let CREATE DATABASE reassign encoding?

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group