Re: The connection to the server was lost. Attempting reset: Failed.

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Yessica Brinkmann <yessica(dot)brinkmann(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: The connection to the server was lost. Attempting reset: Failed.
Date: 2019-10-10 16:14:18
Message-ID: 3613.1570724058@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Yessica Brinkmann <yessica(dot)brinkmann(at)gmail(dot)com> writes:
> I really thought a lot, but I don't understand why but the function fails
> after the expression is executed:
> appendStringInfo (& cols, "% s a.attnum =% 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. FIXME: Avoid
* meddling with the internals of a StringInfo, and try to use an API.
*/
if( cols.len > 0 )
{
pfree( cols.data );
cols.data = NULL;
} /*IF col.len>0*/

Don't do that, use resetStringInfo() instead.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Alban Hertroys 2019-10-10 16:15:06 Re: The connection to the server was lost. Attempting reset: Failed.
Previous Message Yessica Brinkmann 2019-10-10 15:55:43 The connection to the server was lost. Attempting reset: Failed.