[rt-users] user logged out after *every* action? - BUGFIX
Jesse Vincent
jesse at bestpractical.com
Tue Dec 14 08:13:57 EST 2010
There's a patch in rt git for this.
"hubert depesz lubaczewski" <depesz at depesz.com> wrote:
>On Sat, Dec 11, 2010 at 11:33:49PM +0100, hubert depesz lubaczewski
>wrote:
>> Hi,
>> I have rt 3.8.7 working on one server, and it's working fine.
>
>ok. did some more tests, and found the solution.
>
>So. my 3.8.8 is on PostgreSQL 9.0, while 3.8.7 was on 8.4.
>
>The problem with 9.0 is that it changes default bytea encoding.
>
>And bytea is used to store session data:
>$ \d sessions
> Table "public.sessions"
> Column | Type | Modifiers
>-------------+-----------------------------+------------------------
> id | character(32) | not null
> a_session | bytea |
> lastupdated | timestamp without time zone | not null default now()
>Indexes:
> "sessions_pkey" PRIMARY KEY, btree (id)
>
>up to PostgreSQL 8.4, when you had a_session data being string
>'depesz-ąć', it was returned like this:
>depesz-\304\205\304\207
>*but*
>from PostgreSQL 9.0 default encoding for bytea fields is hex. And the
>same bytea value is now returned as:
>\x64657065737a2dc485c487
>
>just so that we are clear - this is the same value - 11 bytes, but it's
>encoded differently.
>
>Apparently rt doesn't handle hex encoding, and when postgresql was
>returning hex-encoded bytea values - it didn't know what to do with it.
>
>I.e. rt was storing values encoded using old method (named "escape"),
>but was given back hex-encoded values.
>
>So. The simple solution is to do this:
>set bytea_output = 'escape';
>in the beginning of every database connection.
>
>Alternatively, we can do this, once:
>alter user rt set bytea_output = 'escape';
>this will change default value of bytea_output (encoding type) for
>every
>*new* connection using user rt.
>
>Alternatively - we could/should teach rt to understand hex-encoded
>bytea
>values.
>
>Actually, hex-encoded values are very simple to encode/decode, and
>basically we should do something like:
>
>if ( $value =~ s/\A\\x// ) {
># This is hex encoding
> $value =~ s/(..)/chr hex $1/ge;
>} else {
> # in here should go previous decoding code
>}
>
>Best regards,
>
>depesz
>
>--
>Linkedin: http://www.linkedin.com/in/depesz / blog:
>http://www.depesz.com/
>jid/gtalk: depesz at depesz.com / aim:depeszhdl / skype:depesz_hdl /
>gg:6749007
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
More information about the rt-users
mailing list