Re: Views no longer in rangeTabls?

From: Amit Langote <amitlangote09(at)gmail(dot)com>
To: David Steele <david(at)pgmasters(dot)net>
Cc: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Views no longer in rangeTabls?
Date: 2023-06-09 11:25:32
Message-ID: CA+HiwqFC0xDCCiXbUjb-xisxo9PPuA8_ykn8Fz+6RbBJBE8mVA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi David,

On Fri, Jun 9, 2023 at 17:28 David Steele <david(at)pgmasters(dot)net> wrote:

> Hackers,
>
> While updating pgAudit for PG16 I found the following (from our
> perspective) regression.
>
> In prior versions of Postgres, views were listed in rangeTabls when
> ExecutorCheckPerms_hook() was called but in PG16 the views are no longer
> in this list.

I’m not exactly sure how pgAudit’s code is searching for view relations in
the range table, but if the code involves filtering on rtekind ==
RTE_RELATION, then yes, such code won’t find views anymore. That’s because
the rewriter no longer adds extraneous RTE_RELATION RTEs for views into the
range table. Views are still there, it’s just that their RTEs are of kind
RTE_SUBQUERY, but they do contain some RELATION fields like relid,
rellockmode, etc. So an extension hook’s relation RTE filtering code
should also consider relid, not just rtekind.

I’m away from a computer atm, so I am not able to easily copy-paste an
example of that from the core code, but maybe you can search for code sites
that need to filter out relation RTEs from the range table.

Perhaps, we are missing a comment near the hook definition mentioning this
detail about views.

> --
Thanks, Amit Langote
EDB: http://www.enterprisedb.com

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message jian he 2023-06-09 11:33:09 Re: Do we want a hashset type?
Previous Message Joel Jacobson 2023-06-09 10:58:18 Re: Do we want a hashset type?