HowTo make Wiki history working with Postgres 90 » History » Version 3

Florian Breitwieser, 2011-02-21 17:31

1 1 Florian Breitwieser
h1. HowTo make Wiki history working with Postgres 9.0
2 1 Florian Breitwieser
3 3 Florian Breitwieser
h2. Problem
4 3 Florian Breitwieser
5 2 Florian Breitwieser
When accessing the history version of a Wiki page (e.g. Wiki?version=16), just a string which is not human readable is displayed. It starts like this and is about 5000 characters long:
6 2 Florian Breitwieser
7 2 Florian Breitwieser
<pre>
8 2 Florian Breitwieser
\x68312e204d532050726f63657373696e6720506970656c696e670d0a0d0a68322e2047656e6572616c2073657475700d0a0d0a57696e646f7773206d616368696e657320617474616368656420746f206d61737370656320617265207573656420746f20636f70792066696c657320746f206365727461696e206c6f636174696f6e732e20402f72
9 2 Florian Breitwieser
10 2 Florian Breitwieser
</pre>
11 2 Florian Breitwieser
Same result for exporting TXT or HTML of the current version, and a Wiki-diff just diffs between two such strings.
12 2 Florian Breitwieser
13 1 Florian Breitwieser
h2. Solution
14 3 Florian Breitwieser
15 1 Florian Breitwieser
PostgreSQL 9 introduced a new 'hex' format for bytea data input and output. Default for output is now hex, but it can be easily reverted to the old 'escape' format with the following command:
16 1 Florian Breitwieser
17 1 Florian Breitwieser
<pre>
18 1 Florian Breitwieser
ALTER DATABASE redmine SET bytea_output TO 'escape';
19 1 Florian Breitwieser
</pre>
20 1 Florian Breitwieser
21 1 Florian Breitwieser
See also #7677.