回复: [BUGS] Re: [BUGS] 回复: [BUGS] BUG #13762: server will crash after superuser alter function and set client_encoding

From: 笑见江湖 <funnyxj(at)qq(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Michael Paquier <michael(dot)paquier(at)gmail(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org <pgsql-bugs(at)postgresql(dot)org>
Subject: 回复: [BUGS] Re: [BUGS] 回复: [BUGS] BUG #13762: server will crash after superuser alter function and set client_encoding
Date: 2015-11-10 06:05:10
Message-ID: tencent_59E660A73F7D2FEF617F9C72@qq.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

If we use elog ERROR or FATAL instead of Assert, we can avoid this crash, so I think it is better than crash.
Besides, are there other functions can run outside transaction except encoding functions?

------------------ 原始邮件 ------------------
发件人: "Tom Lane";<tgl(at)sss(dot)pgh(dot)pa(dot)us>;
发送时间: 2015年11月10日(星期二) 中午12:14
收件人: "Michael Paquier"<michael(dot)paquier(at)gmail(dot)com>;
抄送: "笑见江湖"<funnyxj(at)qq(dot)com>; "pgsql-bugs(at)postgresql(dot)org"<pgsql-bugs(at)postgresql(dot)org>;
主题: Re: [BUGS] Re: [BUGS] 回复: [BUGS] BUG #13762: server will crash after superuser alter function and set client_encoding

Michael Paquier <michael(dot)paquier(at)gmail(dot)com> writes:
> On Tue, Nov 10, 2015 at 9:51 AM, 笑见江湖 <funnyxj(at)qq(dot)com> wrote:
>> Sorry, the correct statements which make server crash is:
>>
>> 1. alter function koi8r_to_utf8(integer, integer, cstring, internal,
>> integer) set work_mem = '4MB';
>> 2. set client_encoding = 'koi8';
>> 3. select 1;

> This indeed crashes, and that's not limited to this particular
> function, try for example iso8859_to_utf8 with ISO_8859_6 as
> client_encoding on even a different parameter for the same result.
> FWIW, here is a backtrace with assertions enabled:

Yeah... if you trace through this, you'll notice that (1) calling a
function having non-null proconfig requires fetching its pg_proc entry,
and (2) fetching anything from a catalog requires being inside a live
transaction, and (3) the client/server encoding translation functions have
to be invokable outside any transaction. So as I said, this is not
going to work and we are not very interested in making it work.

regards, tom lane

--
Sent via pgsql-bugs mailing list (pgsql-bugs(at)postgresql(dot)org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message 笑见江湖 2015-11-10 06:09:36 回复:[BUGS] Re: [BUGS] 回复: [BUGS] BUG #13762: server will crash after superuser alter function and set client_encoding
Previous Message Tom Lane 2015-11-10 04:14:36 Re: Re: [BUGS] 回复: [BUGS] BUG #13762: server will crash after superuser alter function and set client_encoding