From: | alex maslakov <alex(at)serendipia(dot)email> |
---|---|
To: | pgsql-committers(at)lists(dot)postgresql(dot)org |
Subject: | determine what column(s) form the primary key, in C extention |
Date: | 2020-07-27 15:38:02 |
Message-ID: | 2f671cae-a3fe-7064-37d9-68847194ce8d@serendipia.email |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-committers pgsql-general |
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?
From | Date | Subject | |
---|---|---|---|
Next Message | David Rowley | 2020-07-27 21:50:39 | Re: determine what column(s) form the primary key, in C extention |
Previous Message | Michael Paquier | 2020-07-27 07:03:48 | pgsql: Fix corner case with 16kB-long decompression in pgcrypto, take 2 |
From | Date | Subject | |
---|---|---|---|
Next Message | Scott Ribe | 2020-07-27 16:18:33 | Re: is JIT available |
Previous Message | Susan Hurst | 2020-07-27 15:24:20 | Re: shp2pgsql is missing |