Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Un7cv-00080L-FY for pgsql-bugs@arkaria.postgresql.org; Thu, 13 Jun 2013 13:31:45 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1Un7cu-0003iU-Sj for pgsql-bugs@arkaria.postgresql.org; Thu, 13 Jun 2013 13:31:44 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1Un7cu-0003iP-8R for pgsql-bugs@postgresql.org; Thu, 13 Jun 2013 13:31:44 +0000 Received: from sd.tpf.co.jp ([210.161.239.34]) by magus.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Un7cl-00007L-FY for pgsql-bugs@postgresql.org; Thu, 13 Jun 2013 13:31:43 +0000 Received: (qmail 30798 invoked by uid 512); 13 Jun 2013 13:31:30 -0000 X-Authentication: inoue was authenticated by sd.tpf.co.jp at 13 Jun 2013 13:31:30 -0000 Received: from unknown (HELO ?192.168.1.3?) (110.5.25.94) by sd.tpf.co.jp with SMTP; 13 Jun 2013 13:31:30 -0000 Message-ID: <51B9C9A8.9000109@tpf.co.jp> Date: Thu, 13 Jun 2013 22:31:20 +0900 From: Hiroshi Inoue User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:17.0) Gecko/20130509 Thunderbird/17.0.6 MIME-Version: 1.0 To: Andres Freund , Heikki Linnakangas CC: Joshua Berry , pgsql-bugs@postgresql.org, Tom Lane Subject: Re: [ODBC] Segmentation Fault in Postgres server when using psqlODBC References: <51A51147.2060103@tpf.co.jp> <51A75999.6030701@tpf.co.jp> <51AD6351.4030208@tpf.co.jp> <51B0046F.8080908@tpf.co.jp> <51B74E69.4010206@vmware.com> <20130611162652.GA30025@awork2.anarazel.de> In-Reply-To: <20130611162652.GA30025@awork2.anarazel.de> Content-Type: multipart/mixed; boundary="------------070405010600080709040006" X-Pg-Spam-Score: -2.3 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org This is a multi-part message in MIME format. --------------070405010600080709040006 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit (2013/06/12 1:26), Andres Freund wrote: > On 2013-06-11 19:20:57 +0300, Heikki Linnakangas wrote: >> On 11.06.2013 19:04, Joshua Berry wrote: >>> Hiroshi Inoue has developed the attached patch to correct the issue that >>> was reported. More of the dialogue can be found in the pgsql-odbc list. >> >> I tried to follow that thread over at pgsql-odbc, but couldn't quite >> understand what the problem is. Did you have a test program to reproduce it? >> Or failing that, what is the sequence of protocol messages that causes the >> problem? > > I'd guess creating a SQL level WITH HOLD cursor and then fetching that > via the extended protocol, outside the transaction, should do the trick. OK I made a test C program which reproduces the crash. The program uses libpq and a hack. I attached the program. Please modify the connect operation suitable for your environment. Note that the connection should be non-ssl. Also add error checkings if needed. regards, Hiroshi Inoue --------------070405010600080709040006 Content-Type: text/x-csrc; name="heldcursor.c" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="heldcursor.c" I2luY2x1ZGUgPGxpYnBxLWZlLmg+DQojaWZkZWYJV0lOMzINCiNpbmNsdWRl IDxXaW5Tb2NrMi5oPg0KI2Vsc2UNCiNpbmNsdWRlIDxzeXMvdHlwZXMuaD4N CiNpbmNsdWRlIDxzeXMvc29ja2V0Lmg+DQojZW5kaWYNCiNkZWZpbmUJTVlf Q1VSCSJteWN1ciINCmludCBtYWluKGludCBhcmdjLCBjb25zdCBjaGFyICoq YXJndikNCnsNCgljb25zdCBjaGFyCSpjb25uc3RyOw0KCVBHY29ubgkJKmNv bm47DQoJUEdyZXN1bHQJKnJlc3VsdDsNCglpbnQJCQlzb2NrOw0KCWludAkJ CWxlbiwgY291bnQ7DQoNCglpZiAoYXJnYyA+IDEpDQoJCWNvbm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JvclxuIik7DQoJZWxz ZQ0KCQlwcmludGYoInJlc3VsdCBlcnJvcj0lc1xuIiwgUFFyZXN1bHRFcnJv ck1lc3NhZ2UocmVzdWx0KSk7DQoNCglQUWZpbmlzaChjb25uKTsNCg0KCXJl dHVybiAwOw0KfQ== --------------070405010600080709040006 Content-Type: text/plain Content-Disposition: inline Content-Transfer-Encoding: 8bit MIME-Version: 1.0 -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs --------------070405010600080709040006--