Re: Why do we let CREATE DATABASE reassign encoding?

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org, Andrew Dunstan <andrew(at)dunslane(dot)net>
Subject: Re: Why do we let CREATE DATABASE reassign encoding?
Date: 2009-05-06 00:39:31
Message-ID: 15798.1241570371@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I wrote:
> Peter Eisentraut <peter_e(at)gmx(dot)net> writes:
>> AFAIR, the only reason that we haven't disallowed this sort of stuff
>> years and years ago is that people use it; the Japanese in particular.
>> I don't see what is different now.

> What's different now is that 8.4 has already established the principle
> that you have to clone template0 if you want to change the locale of a
> database. I think this is a good time to establish the same principle
> for encodings. (Or in other words, if we don't fix it now, when will
> be a better time?)

Attached is a proposed patch (without documentation changes as yet)
for this. Since the code is already enforcing exact locale match when
cloning a non-template0 database, I just made it act the same for
encoding, without any strange exceptions for SQL_ASCII.

I found that mbregress.sh was already broken by the existing
restrictions, if you try to use it in a database whose default
locale isn't C. The patch adds switches to fix that.

The patch also incidentally fixes a few ereport's that were missing
errcode values.

Last chance for objections ...

regards, tom lane

Attachment Content-Type Size
unknown_filename text/plain 5.9 KB

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Robert Haas 2009-05-06 01:29:33 Re: create if not exists (CINE)
Previous Message Alvaro Herrera 2009-05-06 00:25:54 Re: Values of fields in Rules