Page 1 of 1

Corrupted Attachments under Postgres9

Posted: 24 Sep 2011, 20:32
by JimO
Couldn't find a Postgres wiki or FAQ, so I'm posting this here. Apologies if I missed something.

Postgres9 introduced a configuration option 'bytea_output' that defaults to 'hex' with an alternate option of 'escape'. Prior releases produced escape'd by default.

If your Mantis installation uses $g_allow_file_upload=ON and $g_file_upload_method=DATABASE and your backend is 9.0 or above, you will not be able to view or download any bug attachments without doing some configuration first.(Note uploads/inserts are unaffected, only selecting bytea columns)

Simplest fix is to change the setting in postgresql.conf and restart/sighup your backend.

If you can't change the server setting, it can be overriden at the DB and/or user(role) level by running either of the following

Code: Select all

ALTER DATABASE <your $g_database_name here> SET bytea_output='escape';  
ALTER ROLE <your $g_db_username> SET bytea_output='escape';
Hope this helps the next guy save a couple hours of hair pulling head banging fun

Re: Corrupted Attachments under Postgres9

Posted: 25 Sep 2011, 13:07
by atrol
Thanks for the contribution
I found this known issue http://www.mantisbt.org/bugs/view.php?id=12837