BUG #4158: client encoding is wrong in plpythonu code - Mailing list pgsql-bugs

From Andriy Rysin
Subject BUG #4158: client encoding is wrong in plpythonu code
Date
Msg-id 200805111725.m4BHPOeA075979@wwwmaster.postgresql.org
Whole thread Raw
List pgsql-bugs
The following bug has been logged online:

Bug reference:      4158
Logged by:          Andriy Rysin
Email address:      arysin@gmail.com
PostgreSQL version: 8.3.1
Operating system:   Linux (Mandriva 2008.1) x86_64
Description:        client encoding is wrong in plpythonu code
Details:

$ more test.py
set client_encoding = 'UTF8';

CREATE OR REPLACE FUNCTION test_encoding()
RETURNS varchar AS $$
    import sys

    return sys.getdefaultencoding() + ', can change: ' + str( hasattr(sys,
'setdefaultencoding') )

$$ LANGUAGE plpythonu;

show client_encoding;
select test_encoding();

$ psql krym -f test.py
SET
CREATE FUNCTION
 client_encoding
-----------------
 UTF8
(1 row)

      test_encoding
--------------------------
 ascii, can change: False
(1 row)

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: statement_timeout and crosstab
Next
From: "srinivasulu"
Date:
Subject: BUG #4160: I get this error