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

[DPE-6031] Change owner of functions, procedures and aggregates #773

Merged
merged 1 commit into from
Nov 15, 2024

Conversation

dragomirp
Copy link
Contributor

Issue

When rerelating, the charm assumes there are only functions to change ownership of.

Solution

Inspect the prokind value and use the appropriate alter statement for aggregates, functions and procedures.

Related to #772

Copy link

codecov bot commented Nov 15, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 75.60%. Comparing base (2a7f044) to head (096ba3a).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #773   +/-   ##
=======================================
  Coverage   75.60%   75.60%           
=======================================
  Files          12       12           
  Lines        3116     3116           
  Branches      475      475           
=======================================
  Hits         2356     2356           
  Misses        617      617           
  Partials      143      143           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dragomirp dragomirp marked this pull request as ready for review November 15, 2024 14:46
@dragomirp dragomirp requested review from a team, taurus-forever, marceloneppel and lucasgameiroborges and removed request for a team November 15, 2024 14:46
Comment on lines +378 to +382
FROM pg_proc p JOIN pg_namespace nsp ON p.pronamespace = nsp.oid WHERE NOT nsp.nspname IN ('pg_catalog', 'information_schema') AND p.prokind = 'f'
UNION SELECT 4 AS index,'ALTER PROCEDURE '|| nsp.nspname || '."' || p.proname ||'"('||pg_get_function_identity_arguments(p.oid)||') OWNER TO {};' AS statement
FROM pg_proc p JOIN pg_namespace nsp ON p.pronamespace = nsp.oid WHERE NOT nsp.nspname IN ('pg_catalog', 'information_schema') AND p.prokind = 'p'
UNION SELECT 5 AS index,'ALTER AGGREGATE '|| nsp.nspname || '."' || p.proname ||'"('||pg_get_function_identity_arguments(p.oid)||') OWNER TO {};' AS statement
FROM pg_proc p JOIN pg_namespace nsp ON p.pronamespace = nsp.oid WHERE NOT nsp.nspname IN ('pg_catalog', 'information_schema') AND p.prokind = 'a'
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There could also window functions (w) not handled by this PR.

Copy link
Contributor

Choose a reason for hiding this comment

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

Please create a separate backlog ticket for window functions.

@taurus-forever
Copy link
Contributor

@delgod Lucas and Marcelo are not reachable, can you please review PR to include the next stable we are preparing. Tnx!

@dragomirp dragomirp merged commit a9905ca into main Nov 15, 2024
105 checks passed
@dragomirp dragomirp deleted the dpe-6031-alter-procs branch November 15, 2024 20:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants