Thread: Re: Proper way of iterating over the column names in a trigger function. [ SOLVED]

Re: Proper way of iterating over the column names in a trigger function. [ SOLVED]

From
"Rajesh Kumar Mallah"
Date:
On 12/6/06, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "Rajesh Kumar Mallah" <mallah.rajesh@gmail.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
>