Re: Proper way of iterating over the column names in a trigger function. [ SOLVED] - Mailing list pgsql-sql

From Rajesh Kumar Mallah
Subject Re: Proper way of iterating over the column names in a trigger function. [ SOLVED]
Date
Msg-id a97c77030612060939t6ba0566dkfa27a5539316c313@mail.gmail.com
Whole thread Raw
List pgsql-sql
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
>


pgsql-sql by date:

Previous
From: Richard Ray
Date:
Subject: Query is fast and function is slow
Next
From: "Phillip Smith"
Date:
Subject: INSERT DELETE RETURNING