Re: in C trigger function find out if column is part of primary key

From: Kevin Grittner <kgrittn(at)ymail(dot)com>
To: "Enke, Dr(dot), Michael" <michael(dot)enke(at)wincor-nixdorf(dot)com>, "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org>
Subject: Re: in C trigger function find out if column is part of primary key
Date: 2013-04-02 21:17:23
Message-ID: 1364937443.76835.YahooMailNeo@web162901.mail.bf1.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

"Enke, Dr., Michael" <michael(dot)enke(at)wincor-nixdorf(dot)com> wrote:
> I have to find out if a column ( i = 0, …, tupdesc->natts-1 ) is
> part of a primary key but for performance reasons I do not want
> to execute another query via SPI.  Is this possible?

You might get some inspiration from looking at this bit of code:

http://git.postgresql.org/gitweb/?p=postgresql.git;a=blob;f=contrib/tcn/tcn.c;h=eb7e1a61a6a1d5c5ed2e840af41410ac4a52418f;hb=master#l127

--
Kevin Grittner
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Stephen Scheck 2013-04-02 22:13:03 Dynamic/polymorphic record/composite return types for C user-defined-functions
Previous Message Joe Van Dyk 2013-04-02 20:53:56 Re: Using varchar primary keys.