Received: from localhost (maia-1.hub.org [200.46.204.191]) by postgresql.org (Postfix) with ESMTP id AC56C9FA1A7 for ; Wed, 6 Dec 2006 13:39:30 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.191]) (amavisd-new, port 10024) with ESMTP id 79883-09 for ; Wed, 6 Dec 2006 13:39:24 -0400 (AST) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from py-out-1112.google.com (py-out-1112.google.com [64.233.166.179]) by postgresql.org (Postfix) with ESMTP id 055659F9F0E for ; Wed, 6 Dec 2006 13:39:24 -0400 (AST) Received: by py-out-1112.google.com with SMTP id d32so152057pye for ; Wed, 06 Dec 2006 09:39:23 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:cc:mime-version:content-type:content-transfer-encoding:content-disposition; b=X+6m7SiPs2VD2drTqVJQMyKqKlNeX2iY0hRcEhVlJTAB7LmrdpORE8RqFIwjg1nZ7+0/b0B6q6odzIRa3lqjXrXD+6Wb/aM9+n2lyvFQUl0qFQKrtW5F96vMgwBbr/hxo4lp0/TThZWpXgE26E8U2nuc26ZGy2B4eTqIEmvWr3s= Received: by 10.35.49.15 with SMTP id b15mr1815313pyk.1165426763251; Wed, 06 Dec 2006 09:39:23 -0800 (PST) Received: by 10.35.80.8 with HTTP; Wed, 6 Dec 2006 09:39:23 -0800 (PST) Message-ID: Date: Wed, 6 Dec 2006 23:09:23 +0530 From: "Rajesh Kumar Mallah" To: "Tom Lane" Subject: Re: Proper way of iterating over the column names in a trigger function. [ SOLVED] Cc: pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200612/71 X-Sequence-Number: 27027 On 12/6/06, Tom Lane wrote: > "Rajesh Kumar Mallah" 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 >