=?gb18030?B?u9i4tKO6IFtCVUdTXSAgUmU6IFtCVUdTXSC72Li0?= =?gb18030?B?o7ogW0JVR1NdIEJVRyAjMTM3NjI6IHNlcnZlciB3?= =?gb18030?B?aWxsIGNyYXNoIGFmdGVyIHN1cGVydXNlciBhbHRl?= =?gb18030?B?ciBmdW5jdGlvbiBhbmQgc2V0IGNsaWVudF9lbmNv?= =?gb18030?B?ZGluZw==?= - Mailing list pgsql-bugs

From 笑见江湖
Subject =?gb18030?B?u9i4tKO6IFtCVUdTXSAgUmU6IFtCVUdTXSC72Li0?= =?gb18030?B?o7ogW0JVR1NdIEJVRyAjMTM3NjI6IHNlcnZlciB3?= =?gb18030?B?aWxsIGNyYXNoIGFmdGVyIHN1cGVydXNlciBhbHRl?= =?gb18030?B?ciBmdW5jdGlvbiBhbmQgc2V0IGNsaWVudF9lbmNv?= =?gb18030?B?ZGluZw==?=
Date
Msg-id tencent_59E660A73F7D2FEF617F9C72@qq.com
Whole thread Raw
In response to Re: Re: [BUGS] 回复: [BUGS] BUG #13762: server will crash after superuser alter function and set client_encoding  (Tom Lane <tgl@sss.pgh.pa.us>)
List 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@sss.pgh.pa.us>;
发送时间: 2015年11月10日(星期二) 中午12:14
收件人: "Michael Paquier"<michael.paquier@gmail.com>;
抄送: "笑见江湖"<funnyxj@qq.com>; "pgsql-bugs@postgresql.org"<pgsql-bugs@postgresql.org>;
主题: Re: [BUGS] Re: [BUGS] 回复: [BUGS] BUG #13762: server will crash after superuser alter function and set client_encoding

Michael Paquier <michael.paquier@gmail.com> writes:
> On Tue, Nov 10, 2015 at 9:51 AM, 笑见江湖 <funnyxj@qq.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@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: Re: [BUGS] 回复: [BUGS] BUG #13762: server will crash after superuser alter function and set client_encoding
Next
From: "笑见江湖"
Date:
Subject: =?gb18030?B?u9i4tKO6W0JVR1NdIFJlOiBbQlVHU10gu9i4tKO6?= =?gb18030?B?IFtCVUdTXSBCVUcgIzEzNzYyOiBzZXJ2ZXIgd2ls?= =?gb18030?B?bCBjcmFzaCBhZnRlciBzdXBlcnVzZXIgYWx0ZXIg?= =?gb18030?B?ZnVuY3Rpb24gYW5kIHNldCBjbGllbnRfZW5jb2Rp?= =?gb18030?B?bmc=?=