Accessing fields past CATALOG_VARLEN

From: Ed Behn <ed(at)behn(dot)us>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Accessing fields past CATALOG_VARLEN
Date: 2022-01-03 22:23:54
Message-ID: CAJBL5DOhY+p9w4FxhTji9HbFzbowhNKwG9hJZ_fMPK24GLYF-w@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I'm trying to write a C-language function to be compiled into a
shared module to be loaded by Postgres. In it, I have the OID of a function
and I need to get information from the pg_proc table.

So far, I have:

HeapTuple procTuple;
> Form_pg_proc procStruct;

> procTuple = SearchSysCache1(PROCOID, ObjectIdGetDatum(funcoid));
> if(!HeapTupleIsValid(procTuple))
> ereport(ERROR, errmsg("cache lookup failed for function %u.",
> funcoid));
>

procStruct = (Form_pg_proc) GETSTRUCT(procTuple);

I can get fields like procStruct->prokind and procStruct->proretset.

However, I get a compiler error when I try to access procStruct->proargmodes.
I know that this is because this field is in the CATALOG_VARLEN block which
makes it invisible to the compiler.

What is the proper way to get this field?

-Ed

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2022-01-03 22:27:42 Re: SKIP LOCKED assert triggered
Previous Message Andrew Dunstan 2022-01-03 22:08:05 Re: CREATEROLE and role ownership hierarchies