BXG Blog

Using MovableType with PostgreSQL 9

After a recent upgrade from PostgreSQL 8.4 to 9.2, I found that I could no longer log into my blog admin interface.  The error produced was along the lines of

Can't use string ("x42494...") as an ARRAY ref while "strict refs" in use

After a little research, it appears that the change from escape to hex format for bytea columns in PG 9.0 is the culprit (see their description of bytea for the details).

The recommended fix is to set bytea_output to “escape” in postgresql.conf.  However, I didn’t want to do this globally, since it would stick all my other databases with a compatibility workaround for just a single site.  While researching whether it was possible for MT to set that parameter when it connects, I discovered that you can set database parameters on a per-database level, and then every client that connects gets them by default.  With that newfound knowledge, the real fix is:

ALTER DATABASE dbname SET bytea_output TO 'escape';

And the final conclusion here?  MT4 is pretty old, and issues like this have been accumulating for a while.  As much as I’d prefer not to run a second database on this same machine, it’s starting to look like it might be time to bite the bullet and migrate over to MT5 and MySQL.