Get primary key of a table through SPI

From: Oskar Stenberg <oskar_stenberg(at)outlook(dot)com>
To: "pgsql-general(at)lists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Get primary key of a table through SPI
Date: 2022-03-24 15:49:39
Message-ID: HE1PR03MB2971CD233611E2872B44ECC0F9199@HE1PR03MB2971.eurprd03.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi!

I need to get the primary keys of a few tables for some code that I'm writing in C. I've found out how to do this through regular SQL code and I know that I can use that SQL code through the SPI. But I was just wondering if there is a better/faster way to get information like this directly through the SPI? I'm imagining something similar to how I can get for example the name of the column with the SPI_fname function? Couldn't find anything when I was looking around, but I might have looked in the wrong place?

Best Regards
Oskar

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2022-03-24 15:59:07 Re: Get primary key of a table through SPI
Previous Message Dilip Kumar 2022-03-24 11:36:07 Re: Support logical replication of DDLs