Hi there,
I'm trying to write an extension to study the internals of Postgresql, and
I face a server crash after calling the function relation_open.

I want to call the function ReadBufferExtended
to get the raw data of a given buffer
and I've read in some examples that I need to call relation_open
first, in order to get a Relation variable and also lock the relation.

The function relation_open returns a non NULL pointer in my extension, but
then the last line in the following snippet crashes postgres.

Relation rel;
rel = relation_open(relid, AccessShareLock);

Assert(rel != NULL);
Assert(rel->rd_rel != NULL);
Assert(rel->rd_id != NULL);
elog(INFO, "rel->rd_id not null");
Oid rd_id = rel->rd_id;


Could somebody please help me understand what I'm doing wrong?
(Sorry if this is not the correct mailing list)

Reply via email to