pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Hiroshi Inoue <inoue@tpf.co.jp>
To: Joshua Berry <yoberi@gmail.com>
Cc: pgsql-odbc@postgresql.org
Subject: Re: Segmentation Fault in Postgres server when using psqlODBC
Date: Thu, 06 Jun 2013 12:39:27 +0900
Message-ID: <51B0046F.8080908@tpf.co.jp> (raw)
In-Reply-To: <CAPmZXM08s=6=owEWsu542QSz6ME8McpoA8RwGwSJQHDNS-v5TA@mail.gmail.com>
References: <CAPmZXM3DHRCBi4i3ZcKPOKqi1kd67t-1zHpS=72_1i=Z2PJL5Q@mail.gmail.com>
	<519FDAB3.3010009@tpf.co.jp>
	<CAPmZXM1vpS3Q58jbLk-VhSkKMr_+O2cWOZQzjk8MpFg7khm1eQ@mail.gmail.com>
	<51A51147.2060103@tpf.co.jp>
	<CAPmZXM1ffoi_niJc_Ra7MG1+Anp5Q0-77AAW0YawEJ4hVA3b=g@mail.gmail.com>
	<51A75999.6030701@tpf.co.jp>
	<CAPmZXM1QngGY4svmZMnTOsP4LjcypcLvW+gyz=GbhmTcRDZnpA@mail.gmail.com>
	<51AD6351.4030208@tpf.co.jp>
	<CAPmZXM1jcE3BDi7si9JZUZC1weHUHWx8s3N0JCsmRq-+3o_6Bg@mail.gmail.com>
	<CAPmZXM08s=6=owEWsu542QSz6ME8McpoA8RwGwSJQHDNS-v5TA@mail.gmail.com>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-odbc>

(2013/06/05 0:48), Joshua Berry wrote:
> Hi Hiroshi,
>
> On Tue, Jun 4, 2013 at 9:46 AM, Joshua Berry <yoberi@gmail.com
> <mailto:yoberi@gmail.com>> wrote:
>
>
>     On Mon, Jun 3, 2013 at 10:47 PM, Inoue, Hiroshi <inoue@tpf.co.jp
>     <mailto:inoue@tpf.co.jp>> wrote:
>
>         It's also preferrable to fix the crash at backend.
>         The crash is caused by execute commands after commit.
>
>     That would be the best solution. Thanks for your help.
>
>
> Is there any test code that I could leverage to put together a test case
> which can quickly invoke the backend problem that I'm seeing? Perhaps
> something that is used in the pgsqlODBC project or something else you or
> others might have sitting around? I would like to have a
> testapp/function that could help verify that the issue has been fixed in
> a future backend patch/release.

It seems difficult to provide a test code. However I can reproduce
the crash by changing 1 line of psqlodbc driver source code with a
test case. For example, the crash is fixed by the attached patch.

> I've never explicitly used EXECUTE. Could I construct a plpgsql script
> which could use EXECUTE in a similar manner as psqlODBC, thus creating a
> test case that would have greater portability?

Oops it's an Execute message used in extended query protocol not a
*EXECUTE* command.

regards,
Hiroshi Inoue

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

Attachments:

printtup_holdable_cursor.patch (text/x-patch, 1.4K) download diff --git a/src/backend/access/common/printtup.c b/src/backend/access/common/printtup.c index e87e675..258a4c2 100644 --- a/src/backend/access/common/printtup.c +++ b/src/backend/access/common/printtup.c @@ -238,6 +238,7 @@ printtup_prepare_info(DR_printtup *myState, TupleDesc typeinfo, int numAttrs) { int16 *formats = myState->portal->formats; int i; + bool resownerIsNull = false; /* get rid of any old data */ if (myState->myinfo) @@ -252,6 +253,15 @@ printtup_prepare_info(DR_printtup *myState, TupleDesc typeinfo, int numAttrs) myState->myinfo = (PrinttupAttrInfo *) palloc0(numAttrs * sizeof(PrinttupAttrInfo)); + if (NULL == CurrentResourceOwner) + { + /* + * This occurs when processing execute messages + * for holdable cursors after commit. + */ + resownerIsNull = true; + CurrentResourceOwner = CurTransactionResourceOwner; + } for (i = 0; i < numAttrs; i++) { PrinttupAttrInfo *thisState = myState->myinfo + i; @@ -273,10 +283,16 @@ printtup_prepare_info(DR_printtup *myState, TupleDesc typeinfo, int numAttrs) fmgr_info(thisState->typsend, &thisState->finfo); } else + { + if (resownerIsNull) + CurrentResourceOwner = NULL; ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), errmsg("unsupported format code: %d", format))); + } } + if (resownerIsNull) + CurrentResourceOwner = NULL; } /* ----------------

view thread (18+ messages)  latest in thread

Message-ID: <51B0046F.8080908@tpf.co.jp>
Permalink:  ../51B0046F.8080908@tpf.co.jp/
Also on:    postgresql.org/message-id/51B0046F.8080908@tpf.co.jp

 ·  · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: inoue@tpf.co.jp, yoberi@gmail.com
  Subject: Re: Segmentation Fault in Postgres server when using psqlODBC
  In-Reply-To: <51B0046F.8080908@tpf.co.jp>
  References: <CAPmZXM3DHRCBi4i3ZcKPOKqi1kd67t-1zHpS=72_1i=Z2PJL5Q@mail.gmail.com> <519FDAB3.3010009@tpf.co.jp> <CAPmZXM1vpS3Q58jbLk-VhSkKMr_+O2cWOZQzjk8MpFg7khm1eQ@mail.gmail.com> <51A51147.2060103@tpf.co.jp> <CAPmZXM1ffoi_niJc_Ra7MG1+Anp5Q0-77AAW0YawEJ4hVA3b=g@mail.gmail.com> <51A75999.6030701@tpf.co.jp> <CAPmZXM1QngGY4svmZMnTOsP4LjcypcLvW+gyz=GbhmTcRDZnpA@mail.gmail.com> <51AD6351.4030208@tpf.co.jp> <CAPmZXM1jcE3BDi7si9JZUZC1weHUHWx8s3N0JCsmRq-+3o_6Bg@mail.gmail.com> <CAPmZXM08s=6=owEWsu542QSz6ME8McpoA8RwGwSJQHDNS-v5TA@mail.gmail.com> <51B0046F.8080908@tpf.co.jp>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox