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

Enforcing database encoding and locale match

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Enforcing database encoding and locale match
Date: 2007-09-28 16:02:08
Message-ID: 2811.1190995328@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
I was reminded again just now of the bad consequences of selecting a
database encoding that is not compatible with your LC_CTYPE setting:
http://archives.postgresql.org/pgsql-bugs/2007-09/msg00158.php
Aside from that one, which is perilously close to being a denial of
service attack, there are known problems with sorting, upper()/lower()
behavior, etc etc.  We're going to keep hearing those types of
complaints until we do something about enforcing that people don't use
an incompatible encoding.

This has been discussed before, of course, and has foundered on the
problem that there's no very reliable/portable way to determine what
encoding is implied by LC_CTYPE.  We do have code in initdb that
purports to determine this on common platforms, but I've never trusted
it very much, because it isn't stressed hard in common use.  So the
problem is how to develop some trust in it.

It occurs me that what we could do is put that code into CREATE
DATABASE, but have it throw a WARNING not an ERROR if it thinks the
encoding doesn't match the locale.  That would be sufficiently in
people's faces that we'd hear about it if it didn't work.  After a
release cycle or so of not hearing complaints, we could promote the
warning to an error.

Another possibility is to treat the case as a WARNING if you're
superuser and an ERROR if you're not.  This would satisfy people
who are uncomfortable with the idea that CREATEDB privilege comes
with a built-in denial-of-service attack, while still leaving a
loophole for anyone for whom the test didn't work properly.

Comments?

			regards, tom lane

Responses

pgsql-hackers by date

Next:From: Kevin GrittnerDate: 2007-09-28 16:12:21
Subject: Re: [FEATURE REQUEST] Streaming Onlinebackup(MaybeOFFTOPIC)
Previous:From: Andrew DunstanDate: 2007-09-28 16:00:52
Subject: Re: [pgsql-packagers] Getting to 8.3 beta1

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