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

feat: extensions parameter overrides #76

Merged
merged 4 commits into from
Jan 30, 2024

Conversation

soedirgo
Copy link
Member

Allows overriding create extension parameters. E.g. with:

supautils.extensions_parameter_overrides = '{"pg_cron":{"schema":"pg_catalog"}}'

When someone runs create extension pg_cron with schema public, it gets created in pg_catalog instead:

postgres=> \dx
                 List of installed extensions
  Name   | Version |   Schema   |         Description          
---------+---------+------------+------------------------------
 pg_cron | 1.5     | pg_catalog | Job scheduler for PostgreSQL
 plpgsql | 1.0     | pg_catalog | PL/pgSQL procedural language
(2 rows)

Currently only supports schema, but may support version, owner, etc. in the future.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The latest pg_cron nixpkg (1.6.2) breaks on PG14, so we pin the version on 1.5.2

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pinned pg_cron breaks on pg 16 though. I'll change the test to use a contrib extension to avoid these issues.

Base automatically changed from feat/remove-pg12-support to master January 29, 2024 01:21
@soedirgo soedirgo force-pushed the feat/extensions-parameter-overrides branch from 370e2bd to 8c2fd7a Compare January 29, 2024 02:03
For extensions like pg_cron, the permissions depend on the owner of the
extension object, which in turn depends on which role runs the `CREATE
EXTENSION`.

One might want to temporarily make the user role a superuser during
pg_restore. This would break pg_cron because once the user role is
reverted to non-superuser, the extension owner (i.e. the non-superuser
user role) would not have permissions to execute pg_cron functions.

This is not an issue if we make the `CREATE EXTENSION` run as the
privileged_extensions_superuser unconditionally, since by definition it
would always be a superuser.
Copy link
Member

@steve-chavez steve-chavez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Some docs on the README would be nice.

@soedirgo soedirgo merged commit a426e3f into master Jan 30, 2024
6 checks passed
@soedirgo soedirgo deleted the feat/extensions-parameter-overrides branch January 30, 2024 04:52
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.

2 participants