Get relid for a relation

From: Amin <amin(dot)fallahi(at)gmail(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Get relid for a relation
Date: 2023-01-13 01:48:59
Message-ID: CAF-KA89Ls-u+Ft+BD3R-jpHLxkoFhcuVNJ3UWTGbhkfj7P7ZbA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

In CustomScan cost estimator, where PlannerInfo and RelOptInfo are passed,
I want to get access to the relation stats (for example pg_stat_all_tables)
by calling pg_stat_fetch_stat_tabentry(). However, I don't have access to
relid to pass to this function. For a sample relation, when I hardcode the
relid (for example 16385), it works. However, RelOptInfo->relid is always 1
(for whatever relation the query is scanning). Why this happens and how to
get access to the correct relid (16385) as in pg_stat_all_tables?

Thank you!

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amin 2023-01-13 01:52:21 Re: Get access to the whole query in CustomScan path callback
Previous Message Michael Paquier 2023-01-13 01:45:59 Re: PL/Python: Fix return in the middle of PG_TRY() block.