Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dravi-0008N7-Kl for pgsql-bugs@arkaria.postgresql.org; Tue, 12 Sep 2017 02:28:02 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dravh-0000fw-KJ for pgsql-bugs@arkaria.postgresql.org; Tue, 12 Sep 2017 02:28:01 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dravg-0000fm-VF for pgsql-bugs@postgresql.org; Tue, 12 Sep 2017 02:28:01 +0000 Received: from gauss.credativ.com ([93.94.130.89]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1dravd-0004Ji-L2 for pgsql-bugs@postgresql.org; Tue, 12 Sep 2017 02:27:59 +0000 Received: from gauss.credativ.com (localhost [127.0.0.1]) by gauss.credativ.com (Postfix) with ESMTP id D65021E1A07; Tue, 12 Sep 2017 04:27:52 +0200 (CEST) Received: from feivel.credativ.lan (75-128-38-190.static.mtpk.ca.charter.com [75.128.38.190]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: mme@gauss.credativ.com) by gauss.credativ.com (Postfix) with ESMTPSA id 73ACD1E1944; Tue, 12 Sep 2017 04:27:52 +0200 (CEST) Received: by feivel.credativ.lan (Postfix, from userid 1000) id 9D405589; Mon, 11 Sep 2017 21:14:51 +0200 (CEST) Date: Mon, 11 Sep 2017 21:14:51 +0200 From: Michael Meskes To: davidr@openscg.com Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #14801: ECPG core dump Message-ID: <20170911191451.abi7yqatrsn4spa4@feivel> References: <20170906161212.25634.31573@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="rgrxi2kb65iwkptr" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20170906161212.25634.31573@wrigleys.postgresql.org> User-Agent: NeoMutt/20170609 (1.8.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 --rgrxi2kb65iwkptr Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit On Wed, Sep 06, 2017 at 04:12:12PM +0000, davidr@openscg.com wrote: > Using a int* variable as a where-clause parameter in a declare cursor > construct causes ECPG to Abort (core dump). Using an int variable works > correctly (as expected), and using a pointer type in where clause in a > simple select into works. Could you please try the attached little patch to see if it works with your real life case? It does work with the test case. I will also git push as soon as I'm back on the ground. Thanks. Michael -- Michael Meskes Michael at Fam-Meskes dot De, Michael at Meskes dot (De|Com|Net|Org) Meskes at (Debian|Postgresql) dot Org Jabber: michael at xmpp dot meskes dot org VfL Borussia! Força Barça! Go SF 49ers! Use Debian GNU/Linux, PostgreSQL --rgrxi2kb65iwkptr Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="ecpg.patch" commit e39533aba0adccdff71ee259671cbe81771280a1 Author: Michael Meskes Date: Mon Sep 11 21:10:36 2017 +0200 Fixed ECPG to correctly handle out-of-scope cursor declarations with pointers or array variables. diff --git a/src/interfaces/ecpg/preproc/ecpg.header b/src/interfaces/ecpg/preproc/ecpg.header index 2562366bbe..a52da01b1f 100644 --- a/src/interfaces/ecpg/preproc/ecpg.header +++ b/src/interfaces/ecpg/preproc/ecpg.header @@ -352,7 +352,7 @@ adjust_outofscope_cursor_vars(struct cursor *cur) else { newvar = new_variable(cat_str(4, mm_strdup("("), - mm_strdup(ecpg_type_name(ptr->variable->type->type)), + mm_strdup(ecpg_type_name(ptr->variable->type->u.element->type)), mm_strdup(" *)(ECPGget_var("), mm_strdup(var_text)), ECPGmake_array_type(ECPGmake_simple_type(ptr->variable->type->u.element->type, --rgrxi2kb65iwkptr 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 --rgrxi2kb65iwkptr--