On 12/6/06, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
> "Rajesh Kumar Mallah" <mallah(dot)rajesh(at)gmail(dot)com> writes:
> > what is the proper way for iterating over column names of a table using
> > SPI_* functions.
>
> You need to pay attention to the attisdropped field of the TupleDesc
> entries.
thanks.
did the below (hopefully gotcha free)
for (i = 1; i <= tupdesc->natts ; i++)
{
if ( tupdesc->attrs[i-1]->attisdropped)
continue;
col_name = SPI_fname(tupdesc, i);
elog (NOTICE , "colname: %s" , col_name);
}
Warm Regds
Mallah.
>
> regards, tom lane
>