Debian, Coders-Nemesis, Hier, Spaceshooter, Schule, Programmieren, Web, VCS, Unknown-Horizons, Linux, Kurios, FOSS, FIFE, kFreeBSD, Rant, Politik, Uni, Fail, Functional, HowTo, Erlang, Hurd, Porting, Security, DBs, PostgreSQL, Android, GnuPG
+Programmieren, +PostgreSQL
+Programmieren, +PostgreSQL
Stories tagged DBs:
Quick notes about PostgreSQL; tags=Programmieren, DBs, PostgreSQL
-- Christoph Egger <christoph@coders-nemesis.eu> Tue, 17 May 2011 10:30:22 +0200

Quick notes about PostgreSQL; tags=Programmieren, DBs, PostgreSQL
Imagine you have a old postgresql database. Further imagine it has it's encoding set to something like LATIN-1 but some PHP web application has put in UTF-8 strings. Now what would you do if you have some python application actually respecting the encoding and recoding the db content from latin-1 to UTF-8 giving you garbage. Seems you can easily trick postgresql to now believe it is UTF-8:
UPDATE pg_database SET encoding = 6 WHERE datname = 'foo';
For a summary of these magic numbers the PostgreSQL Manual is usefull.
-- Christoph Egger <christoph@coders-nemesis.eu> Tue, 17 May 2011 10:30:22 +0200