determine what column(s) form the primary key, in C extention
От
alex maslakov
Тема
determine what column(s) form the primary key, in C extention
Дата
Msg-id
2f671cae-a3fe-7064-37d9-68847194ce8d@serendipia.email
Список
Дерево обсуждения
determine what column(s) form the primary key, in C extention alex maslakov <alex@serendipia.email>
Re: determine what column(s) form the primary key, in C extention David Rowley <dgrowleyml@gmail.com>
Hey. I'm creating an extention in C. An extention will be fired as, or inside, a trigger. What I need: dynamically, inside a trigger, identify which column, or columns if the primary key is composed of multiple columns, form the primary key -- their indexes or names. I need a fast way, therefore I don't consider using SPI_exec(..) and the like. I was suggested to use `get_primary_key_attnos` from `src/include/catalog/pg_constraint.h` extern Bitmapset *get_primary_key_attnos(Oid relid, bool deferrableOk) It returns *Bitstamp. And it's got "nwords" and "words[]". But those return just big numbers, not something that look similar to an index of the primary key column. And therefore I haven't had any luck thus far. How to do it?
В списке pgsql-committers по дате отправления
От: Michael Paquier
Дата:
От: David Rowley
Дата: