Skip to content

Drop the original_role temp table from install (#12/#13)#20

Open
jnasbyupgrade wants to merge 1 commit into
Postgres-Extensions:masterfrom
jnasbyupgrade:fix/12-13-original-role
Open

Drop the original_role temp table from install (#12/#13)#20
jnasbyupgrade wants to merge 1 commit into
Postgres-Extensions:masterfrom
jnasbyupgrade:fix/12-13-original-role

Conversation

@jnasbyupgrade

Copy link
Copy Markdown
Collaborator

Both install scripts saved the caller's role in a CREATE TEMP TABLE original_role ON COMMIT DROP so they could SET LOCAL ROLE test_factory__owner and restore it afterward. That temp table becomes extension-owned, so ON COMMIT DROP conflicts with extension ownership (#12: uninstallable; #13: COMMIT fails), and it also collides if the caller already has an original_role temp table.

Fix: save the caller's role in a transaction-local GUC via set_config('<ext>.original_role', current_user, true) and restore with SET ROLE at end of script — no extension-owned object, no ON COMMIT DROP. Independent of the pgxntool sync (#19); #12/#13 are already closed.

…iginal_role temp table from install

Both install scripts saved the caller's role in a CREATE TEMP TABLE ... ON COMMIT DROP so they could SET LOCAL ROLE to own objects and restore afterward. That temp table becomes extension-owned, so ON COMMIT DROP conflicts with extension ownership (uninstallable / COMMIT failures, Postgres-Extensions#12/Postgres-Extensions#13), and it collides if the caller already has an original_role temp table. Save the role in a transaction-local GUC via set_config() instead -- no extension-owned object.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
(cherry picked from commit 4c688a472328ad6f2f6eaf1b963e023cf5553d22)
@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: b9a4cdcc-3e89-4983-bb71-0109b54365bf

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant