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

Re: Why do we let CREATE DATABASE reassign encoding?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: Why do we let CREATE DATABASE reassign encoding?
Date: 2009-04-23 19:00:25
Message-ID: 2276.1240513225@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
Andrew Dunstan <andrew(at)dunslane(dot)net> writes:
> So the following sequence woiuld be illegal:

> initdb -E latin1
> createdb -E utf8

Yes, that's rather the point.  Note that it already *is* illegal
unless you happen to have selected C locale; AFAICS that is an
oversight and not intentional.  For instance, going in the other
direction in en_US locale, I get

$ createdb -E latin1 l1
createdb: database creation failed: ERROR:  encoding LATIN1 does not match locale en_US.utf8
DETAIL:  The chosen LC_CTYPE setting requires encoding UTF8.

You can get around this by cloning template0 instead of template1
(we assume template0 contains nothing that's encoding-specific).
Possibly the docs will need to be improved to emphasize that.

			regards, tom lane

In response to

Responses

pgsql-hackers by date

Next:From: Andrew DunstanDate: 2009-04-23 19:06:15
Subject: Re: Why do we let CREATE DATABASE reassign encoding?
Previous:From: Greg StarkDate: 2009-04-23 18:59:52
Subject: Re: Why do we let CREATE DATABASE reassign encoding?

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