Corrupted Attachments under Postgres9

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
JimO
Posts: 1
Joined: 27 Apr 2011, 16:18

Corrupted Attachments under Postgres9

Post 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
atrol
Site Admin
Posts: 8536
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Corrupted Attachments under Postgres9

Post by atrol »

Thanks for the contribution
I found this known issue http://www.mantisbt.org/bugs/view.php?id=12837
Please use Search before posting and read the Manual
Post Reply