Re: on placeholder entries in view rule action query's range table - Mailing list pgsql-hackers

From Tom Lane
Subject Re: on placeholder entries in view rule action query's range table
Date
Msg-id 2060563.1680725102@sss.pgh.pa.us
Whole thread Raw
In response to Re: on placeholder entries in view rule action query's range table  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
I wrote:
> Amit Langote <amitlangote09@gmail.com> writes:
>> While thinking about query view locking in context of [1], I realized
>> that we have missed also fixing AcquirePlannerLocks() /
>> ScanQueryForLocks() to consider that an RTE_SUBQUERY rte may belong to
>> a view, which must be locked the same as RTE_RELATION entries.

> I think you're right about that, because AcquirePlannerLocks is supposed
> to reacquire whatever locks parsing+rewriting would have gotten.

After poking at this a bit more, I'm not sure there is any observable bug,
because we still notice the view change in AcquireExecutorLocks and
loop back to re-plan after that.  It still seems like a good idea to
notice such changes sooner not later to reduce wasted work, so I went
ahead and pushed the patch.

The only way it'd be a live bug is if the planner actually fails because
it's working with a stale view definition.  I tried to make it fail by
adjusting the view to no longer use an underlying table and then
dropping that table ... but AcquirePlannerLocks still detected that,
because of course it recurses and locks the table reference it finds
in the view subquery.  Maybe you could make a failure case involving
dropping a user-defined function instead, but I thought that was getting
pretty far afield, so I didn't pursue it.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Should vacuum process config file reload more often
Next
From: Tom Lane
Date:
Subject: Re: monitoring usage count distribution