Thank you very much for the reply.
Well, really, resetStringInfo () is a function of the StringInfo data structure.
What I used at the end was initStringInfo, which is a function of the data structure StringInfoData, which is what I am using, although I don't know if they are equivalent.
The code remained as follows:
if (cols.len> 0)
{
initStringInfo (& cols);
} / * IF col.len> 0 * /
But it continues giving me the same error.
Well, really, resetStringInfo () is a function of the StringInfo data structure.
What I used at the end was initStringInfo, which is a function of the data structure StringInfoData, which is what I am using, although I don't know if they are equivalent.
The code remained as follows:
if (cols.len> 0)
{
initStringInfo (& cols);
} / * IF col.len> 0 * /
But it continues giving me the same error.
Best regards,
Yessica Brinkmann
El jue., 10 oct. 2019 a las 13:33, Yessica Brinkmann (<yessica.brinkmann@xxxxxxxxx>) escribió:
Thank you so much for your answer. I will be testing the indicated and then I give you return.
Best regards,Yessica BrinkmannEl jue., 10 oct. 2019 a las 13:14, Tom Lane (<tgl@xxxxxxxxxxxxx>) escribió:Yessica Brinkmann <yessica.brinkmann@xxxxxxxxx> 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 = ""> } /*IF col.len>0*/
Don't do that, use resetStringInfo() instead.
regards, tom lane