Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PG16: Refactored ownercheck functions #6242

Conversation

fabriziomello
Copy link
Contributor

@fabriziomello fabriziomello commented Oct 27, 2023

In our code we have an Event Trigger on ddl_command_end to process some DDL commands, and specially the ALTER TABLE we execute some code to properly deal with hypertables, chunks and compressed chunks.

The problem is when we start to process our code at ddl_command_end event we get the related relid by calling the AlterTableLookupRelation that perform the proper acl checking. But this is a bit wrong because in case of a ALTER TABLE ... OWNER TO ... at this point (aka ddl_command_end) the ownership of the relation was already processed and with this PG16 refactoring it now is visible for the object_ownercheck leading to a misbehavior.

Due to our intention is just the get the relid related to the AlterTableCmd just fixed it by replacing the AlterTableLookupRelation for the RangeVarGetRelid because at this point all the proper aclcheck was already done.

postgres/postgres@afbfc029

Disable-check: force-changelog-file

In our code we have an Event Trigger on `ddl_command_end` to process
some DDL commands, and specially the `ALTER TABLE` we execute some code
to properly deal with hypertables, chunks and compressed chunks.

The problem is when we start to process our code at `ddl_command_end`
event we get the related `relid` by calling the `AlterTableLookupRelation`
that perform the proper acl checking. But this is a bit wrong because in
case of a `ALTER TABLE ... OWNER TO ...` at this point (aka
`ddl_command_end`) the ownership of the relation was already processed
and with this PG16 refactoring it now is visible for the
`object_ownercheck` leading to a misbehavior.

Due to our intention is just the get the `relid` related to the
AlterTableCmd just fixed it by replacing the `AlterTableLookupRelation`
for the `RangeVarGetRelid` because at this point all the proper aclcheck
was already done.

postgres/postgres@afbfc029
@fabriziomello fabriziomello added the pg16 Issue/PR related to support for PG16 label Oct 27, 2023
@fabriziomello fabriziomello self-assigned this Oct 27, 2023
@github-actions github-actions bot requested review from akuzm and antekresic October 27, 2023 15:51
@github-actions
Copy link

@antekresic, @akuzm: please review this pull request.

Powered by pull-review

@codecov
Copy link

codecov bot commented Oct 27, 2023

Codecov Report

Merging #6242 (2ca4140) into main (e30967f) will decrease coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main    #6242      +/-   ##
==========================================
- Coverage   65.10%   65.08%   -0.03%     
==========================================
  Files         246      246              
  Lines       57066    57020      -46     
  Branches    12651    12632      -19     
==========================================
- Hits        37151    37109      -42     
- Misses      18046    18058      +12     
+ Partials     1869     1853      -16     
Files Coverage Δ
src/process_utility.c 88.38% <100.00%> (ø)

... and 64 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@fabriziomello fabriziomello enabled auto-merge (rebase) October 27, 2023 16:08
@fabriziomello fabriziomello merged commit 29fe401 into timescale:main Oct 27, 2023
39 of 40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pg16 Issue/PR related to support for PG16
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants