Christoph's last Weblog entries

Entries tagged "dbs".

Quick notes about PostgreSQL
17th May 2011

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.

Tags: dbs, postgresql, programmieren.

RSS Feed

Created by Chronicle v4.6