Re: AW: AW: BUG #18147: ERROR: invalid perminfoindex 0 in RTE with relid xxxxx
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Amit Langote <amitlangote09@gmail.com>
Cc: Hans Buschmann <buschmann@nidsa.net>, Peter Geoghegan <pg@bowt.ie>,
"David G. Johnston" <david.g.johnston@gmail.com>,
"pgsql-bugs@lists.postgresql.org" <pgsql-bugs@lists.postgresql.org>
Date: 2023-10-24T14:48:52Z
Lists: pgsql-bugs
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Prevent duplicate RTEPermissionInfo for plain-inheritance parents
- 01575ad788e3 17.0 landed
- 178ee1d858d8 16.1 landed
-
Fix problems when a plain-inheritance parent table is excluded.
- b1444a09dcb5 16.1 landed
- 8f4a6b9e4f5b 14.10 landed
- 1268e7378123 15.5 landed
- 387f9ed0a083 17.0 landed
-
Doc: indexUnchanged is strictly a hint.
- 74e5ea1e002f 17.0 landed
- cf89d3052d62 16.1 landed
- be2502947f29 15.5 landed
- df73ca35144a 14.10 landed
Amit Langote <amitlangote09@gmail.com> writes:
> On Tue, Oct 24, 2023 at 5:59 AM Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> Maybe we could fix this by setting ModifyTable.rootRelation to
>> the parent relation in the plain-inheritance case not only the
>> partitioned case; but I've not investigated what else might be
>> expecting it to be set only for partitions.
> That appears to be the easiest fix to me (attached PoC makes the error
> go away for me and passes check-world).
> By setting rootRelation for plan-inheritance roots, there would be two
> ResultRelInfos for the root relation (that is, if it's also present in
> resultRelations, unlike in this case) -- one in
> ModifyTableState.rootResultRelInfo and another in the 1st element of
> ModifyTableState.resultRelInfo[]. That might be fine, because,
> AFAICS, the partitioning-related code sites that look at the former
> have checks to ensure that they don't accidentally try to access a
> plain-inheritance relation as a partitioned one. I might need to take
> a closer look.
I suggest that it might be cleaner if we make rootRelation point
to the original appendrel (that is, the RTE entry with inh = true).
That would be exactly parallel to the partitioning situation, in
that that RTE is not scanned in the plan. But it's for the same
table as what's normally the first result table, so it should have
the same permissions info.
BTW, I noted while looking at this example that there are two
RTEPermissionInfo structs with identical contents, one for the
appendrel RTE and one for the first child. That seems kind of
unnecessary.
> I decided to look at fire{BS|AS}Triggers() first, because we changed
> them in f49b85d783f to look at ModifyTableState.rootResultRelInfo to
> get the table whose triggers to fire. They seem broken for this case:
Yuck. But either proposal above would fix that, right?
regards, tom lane