From: Rajesh Kumar Mallah <mallah.rajesh@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: pgsql-sql@postgresql.org
Subject: Re: Proper way of iterating over the column names in a trigger function. [ SOLVED]
Date: Wed, 6 Dec 2006 23:09:23 +0530
Message-ID: <a97c77030612060939t6ba0566dkfa27a5539316c313@mail.gmail.com> (raw)
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
>
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: mallah.rajesh@gmail.com, tgl@sss.pgh.pa.us
Subject: Re: Proper way of iterating over the column names in a trigger function. [ SOLVED]
In-Reply-To: <a97c77030612060939t6ba0566dkfa27a5539316c313@mail.gmail.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox