Re: BUG #17946: LC_MONETARY & DO LANGUAGE plperl - BUG

From: Heikki Linnakangas <hlinnaka(at)iki(dot)fi>
To: Joe Conway <mail(at)joeconway(dot)com>, Tristan Partin <tristan(at)neon(dot)tech>
Cc: gdo(at)leader(dot)it, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: BUG #17946: LC_MONETARY & DO LANGUAGE plperl - BUG
Date: 2023-08-27 20:24:59
Message-ID: c9ba493c-63bb-4c32-d7dc-6f5862a29bb1@iki.fi
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

On 27/08/2023 16:41, Joe Conway wrote:
> On 8/15/23 10:40, Heikki Linnakangas wrote:
>> If multiple interpreters are used, is the single perl_locale_obj
>> variable still enough? Each interpreter can have their own locale I believe.
>
> So in other words plperl and plperlu both used in the same query? I
> don't see how we could get from one to the other without going through
> the outer "postgres" locale first. Or are you thinking something else?

I think you got that it backwards. 'perl_locale_obj' is set to the perl
interpreter's locale, whenever we are *outside* the interpreter.

This crashes with the patch:

postgres=# DO LANGUAGE plperlu
$function$
use POSIX qw(setlocale LC_NUMERIC);
use locale;

setlocale LC_NUMERIC, "sv_SE.utf8";
$function$;
DO
postgres=# do language plperl $$ $$;
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The connection to the server was lost. Attempting reset: Failed.

I was going to test using plperl and plperl in the same session and
expected the interpreters to mix up the locales they use. Maybe the
crash is because of something like that, although I didn't expect a
crash, just weird confusion on which locale is used.

--
Heikki Linnakangas
Neon (https://neon.tech)

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Michael Paquier 2023-08-28 02:15:28 Re: cache lookup failed dropping public schema with trgm index
Previous Message Joe Conway 2023-08-27 13:41:01 Re: BUG #17946: LC_MONETARY & DO LANGUAGE plperl - BUG

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2023-08-27 22:29:39 CI speed improvements for FreeBSD
Previous Message Joseph Koshakow 2023-08-27 20:14:00 Re: DecodeInterval fixes