Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iIb56-00026o-Jh for pgsql-general@arkaria.postgresql.org; Thu, 10 Oct 2019 16:14:24 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iIb55-0002R8-BP for pgsql-general@arkaria.postgresql.org; Thu, 10 Oct 2019 16:14:23 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iIb55-0002Qx-0I for pgsql-general@lists.postgresql.org; Thu, 10 Oct 2019 16:14:23 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iIb52-0001yi-U3 for pgsql-general@postgresql.org; Thu, 10 Oct 2019 16:14:22 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id x9AGEIx7003614; Thu, 10 Oct 2019 12:14:18 -0400 From: Tom Lane To: Yessica Brinkmann cc: pgsql-general@postgresql.org Subject: Re: The connection to the server was lost. Attempting reset: Failed. In-reply-to: References: Comments: In-reply-to Yessica Brinkmann message dated "Thu, 10 Oct 2019 12:55:43 -0300" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3612.1570724058.1@sss.pgh.pa.us> Content-Transfer-Encoding: quoted-printable Date: Thu, 10 Oct 2019 12:14:18 -0400 Message-ID: <3613.1570724058@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Yessica Brinkmann writes: > I really thought a lot, but I don't understand why but the function fail= s > after the expression is executed: > appendStringInfo (& cols, "% s a.attnum =3D% d", (i> 0? "OR": ""), idxcd= -> > varattno [i]); I think you're probably shooting yourself in the foot here: /* pfree() the memory allocated for the previous candidate. FI= XME: Avoid * meddling with the internals of a StringInfo, and try to use = an API. */ if( cols.len > 0 ) { pfree( cols.data ); cols.data =3D NULL; } /*IF col.len>0*/ Don't do that, use resetStringInfo() instead. regards, tom lane