From: | "Enke, Dr(dot), Michael" <michael(dot)enke(at)wincor-nixdorf(dot)com> |
---|---|
To: | "'pgsql-general(at)postgresql(dot)org'" <pgsql-general(at)postgresql(dot)org> |
Subject: | in C trigger function find out if column is part of primary key |
Date: | 2013-03-31 22:06:25 |
Message-ID: | D0705BB737A20D4EA166124FF1BA8C630101F654279E@DEEXVS61.wincor-nixdorf.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Hello C-(trigger)-experts,
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?
Currently I did not find a way, instead I check for "not null" attribute tupdesc->attrs[i]->attnotnull
and in addition if the column is used in an index via relation->rd_indexattr
but this Bitmapset has 8 leading zeros.
Is there a define which I can use instead of hardcode the 8? Currently I use bms_is_member(i + 8, rd_indexattr)
Thank you,
Michael
WINCOR NIXDORF International GmbH
Sitz der Gesellschaft: Paderborn
Registergericht Paderborn HRB 3507
Geschäftsführer: Eckard Heidloff (Vorsitzender), Dr. Jürgen Wunram (stellv. Vors.), Jens Bohlen
Vorsitzender des Aufsichtsrats: Dr. Alexander Dibelius
Steuernummer: 339/5884/0020 - Ust-ID Nr.: DE812927716 - WEEE-Reg.-Nr. DE44477193
Diese E-Mail enthält vertrauliche Informationen.
Wenn Sie nicht der richtige Adressat sind oder diese E-Mail irrtümlich erhalten haben,
informieren Sie bitte sofort den Absender und vernichten Sie diese E-Mail.
Das unerlaubte Kopieren sowie die unbefugte Weitergabe dieser E-Mail ist nicht gestattet.
This e-mail may contain confidential information.
If you are not the intended recipient (or have received this e-mail in error)
please notify the sender immediately and destroy this e-mail.
Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
From | Date | Subject | |
---|---|---|---|
Next Message | Juan Pablo Cook | 2013-03-31 22:06:43 | JDBC Array double precision [] error |
Previous Message | komunca | 2013-03-31 21:44:30 | High CPU usage of stats collector |