Skip to content

Get primary keys dynamically, via a C extention #4

@naddika

Description

@naddika

This isn't directly related to this project; perhaps you know the answer:

I'm writting an extention in C. It's a function for a trigger. I need to dynamically identify which column, or columns, if the primary key is composed of multiple columns, is the primary key -- their indexes or names.

I suppose, the function get_primary_key_attnos can help me.

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.

Therefore, I haven't been able to figure out how to proceed with it and identify the primary key. Any idea?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions