Good day, I am doing a thesis from the University. My thesis is the modification of the Gurjeet Index Adviser, to add some features. I have a function called get_columnnames, which runs on a Postgresql server and returns the names of the columns of a table in a Postgresql database. In the first foreach, in the statement: idxcd-> varattnames [cont] = data; column names are saved. Those column names are saved correctly. I could verify this by printing some values. But later, in the following foreach, when I reprint the values of the names of the columns that had been saved in the idxcd-> varattnames [cont] = data statement; They appear to me with errors. That is, for example: if a and b were saved, then print me b and b. This occurs only when foreach is entered more than once, that is, when there is more than one candidate index. The truth is that I thought a lot why this can happen but I can't find an answer. I will greatly appreciate an answer please. The line with emphasis (* *) is the one that produces the wrong result. I clarify that the foreach cycle for the c language is defined in #include "nodes / pg_list.h" I am using Postgresql 8.3.23. I clarify that I use that version because it is compatible with the Index Adviser, which I am modifying for my University thesis. The Linux distribution I use is Debian 9.x 64-bit. And the version of C (gcc) that I use is 6.3.0 I attach my source code. Best regards, Yessica Brinkmann
funcion.c
Description: Binary data