Re: Segmentation fault on RelationGetDescr in my first extension

From: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
To: dmitry(dot)cvetkov(at)gmail(dot)com
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Segmentation fault on RelationGetDescr in my first extension
Date: 2023-01-10 06:01:52
Message-ID: 20230110.150152.403193641407208227.horikyota.ntt@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

At Thu, 29 Dec 2022 13:52:18 +0300, Дмитрий Цветков <dmitry(dot)cvetkov(at)gmail(dot)com> wrote in
> I'm trying to write my first extension and open a table in it.
> I use check_password_hook and my function executes at the moment of
> changing user password.
>
> But if I try to open a table inside this function, I get Segmentation fault
> on the line with "RelationGetDescr".
> What am I doing wrong?

table_open() should error out when it is going to return an invalid
Relation*, and RelationGetDescr(rel) is "rel->rd_att". So the
RelationGetDescr() cannot get a segv even if the table does not exist.

# I modified contrib/passwordcheck that way and saw RelationGetDescr()
# doesn't get segv in the shown context.

I guess the segv comes from another place, or something else has
broken memory until there. but anyway more information is needed for
people to diagnose your situation more closely.

regards.

--
Kyotaro Horiguchi
NTT Open Source Software Center

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Alicja Kucharczyk 2023-01-10 13:14:03 Use case for enabling log_duration other than benchmarking
Previous Message Martin Ritchie 2023-01-10 04:51:19 pg_multixact_member file limits