By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,373 Members | 1,984 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,373 IT Pros & Developers. It's quick & easy.

Locale bug?

P: n/a

Here is a simplificated example:

CREATE OR REPLACE FUNCTION ttt () RETURNS text AS '
return "";
' LANGUAGE 'plperlu';

CREATE OR REPLACE FUNCTION qqq () RETURNS text as '
DECLARE
v_text text;
v_text2 text;
BEGIN
v_text := upper(''ΔΟ''); -- cyrillic chars
v_text2 := ttt();
RETURN v_text || upper(''ΠΟΣΜΕ''); -- cyrillic chars
END;
' LANGUAGE 'plpgsql';

and qqq() returns "δοΠΟΣΜΕ". That is upper() doesn't work correctly
after plperlu function call.

--
Sergey Suleymanov
Nov 12 '05 #1
Share this Question
Share on Google+
5 Replies


P: n/a
Sergey Suleymanov <so**@eatpbank.ru> writes:
... That is upper() doesn't work correctly
after plperlu function call.


It sounds like Perl is taking it on itself to change the process'
LC_CTYPE settings. That's very nasty of it :-(. Can anyone confirm
that libperl does such things, or find a workaround to prevent it?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

Nov 12 '05 #2

P: n/a
>>>>> Tom Lane writes:
... That is upper() doesn't work correctly after plperlu function
call.


Tom> It sounds like Perl is taking it on itself to change the
Tom> process' LC_CTYPE settings. That's very nasty of it :-(. Can
Tom> anyone confirm that libperl does such things, or find a
Tom> workaround to prevent it?

It seems a startup script issue. When I restarting postmaster
manualy (within root session with LC_CTYPE = ru_RU.KOI8-R)
everything works fine.

Do we need "export LANG=..." before starting postmaster?

--
Sergey Suleymanov
Nov 12 '05 #3

P: n/a
Sergey Suleymanov <so**@eatpbank.ru> writes:
Tom Lane writes:
... That is upper() doesn't work correctly after plperlu function
call.
Tom> It sounds like Perl is taking it on itself to change the
Tom> process' LC_CTYPE settings. That's very nasty of it :-(. Can
Tom> anyone confirm that libperl does such things, or find a
Tom> workaround to prevent it? It seems a startup script issue. When I restarting postmaster
manualy (within root session with LC_CTYPE = ru_RU.KOI8-R)
everything works fine. Do we need "export LANG=..." before starting postmaster?


Hm. The postmaster extracts the correct setlocale() values from the
pg_control file, but IIRC it doesn't bother to set the environment
variables LC_CTYPE etc. Maybe it should. Peter, I think this is your
turf --- what do you think?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 12 '05 #4

P: n/a
>>>>> Tom Lane writes:
... That is upper() doesn't work correctly after plperlu function
call.


Tom> It sounds like Perl is taking it on itself to change the
Tom> process' LC_CTYPE settings. That's very nasty of it :-(. Can
Tom> anyone confirm that libperl does such things, or find a
Tom> workaround to prevent it?

It seems a startup script issue. When I restarting postmaster
manualy (within root session with LC_CTYPE = ru_RU.KOI8-R)
everything works fine.

Do we need "export LANG=..." before starting postmaster?

--
Sergey Suleymanov
Nov 12 '05 #5

P: n/a
Sergey Suleymanov <so**@eatpbank.ru> writes:
Tom Lane writes:
... That is upper() doesn't work correctly after plperlu function
call.
Tom> It sounds like Perl is taking it on itself to change the
Tom> process' LC_CTYPE settings. That's very nasty of it :-(. Can
Tom> anyone confirm that libperl does such things, or find a
Tom> workaround to prevent it? It seems a startup script issue. When I restarting postmaster
manualy (within root session with LC_CTYPE = ru_RU.KOI8-R)
everything works fine. Do we need "export LANG=..." before starting postmaster?


Hm. The postmaster extracts the correct setlocale() values from the
pg_control file, but IIRC it doesn't bother to set the environment
variables LC_CTYPE etc. Maybe it should. Peter, I think this is your
turf --- what do you think?

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 2: you can get off all lists at once with the unregister command
(send "unregister YourEmailAddressHere" to ma*******@postgresql.org)

Nov 12 '05 #6

This discussion thread is closed

Replies have been disabled for this discussion.