Skip to content

Commit

Permalink
Don't use regprocedure in catalogs.
Browse files Browse the repository at this point in the history
Using regprocedure was nice to be able to track the functions used in
system versioning queries, but it prevented pg_upgrade which is a deal
breaker.  The other reg* types used (regclass and regtype) do not have
this problem so they can stay.
  • Loading branch information
Vik Fearing committed Sep 21, 2020
1 parent 2e9dc5e commit 58e30e5
Show file tree
Hide file tree
Showing 13 changed files with 481 additions and 85 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

Users must REINDEX all indexes on history tables.

- Don't use `regprocedure` in our catalogs, they prevent `pg_upgrade` from working.
This reduces functionality a little but, but not being able to upgrade is a
showstopper.

## [1.1] – 2020-02-05

### Added
Expand Down
40 changes: 20 additions & 20 deletions expected/acl.out
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ TABLE show_acls ORDER BY sort_order;

GRANT SELECT, UPDATE ON TABLE fpacl__for_portion_of_p TO periods_acl_2; -- fail
ERROR: cannot grant SELECT directly to "fpacl__for_portion_of_p"; grant SELECT to "fpacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 125 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 143 at RAISE
GRANT SELECT, UPDATE ON TABLE fpacl TO periods_acl_2;
TABLE show_acls ORDER BY sort_order;
sort_order | schema_name | object_name | object_type | grantee | privilege_type
Expand All @@ -233,7 +233,7 @@ TABLE show_acls ORDER BY sort_order;

REVOKE UPDATE ON TABLE fpacl__for_portion_of_p FROM periods_acl_2; -- fail
ERROR: cannot revoke UPDATE directly from "fpacl__for_portion_of_p", revoke UPDATE from "fpacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 237 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 255 at RAISE
REVOKE UPDATE ON TABLE fpacl FROM periods_acl_2;
TABLE show_acls ORDER BY sort_order;
sort_order | schema_name | object_name | object_type | grantee | privilege_type
Expand Down Expand Up @@ -380,13 +380,13 @@ TABLE show_acls ORDER BY sort_order;
-- These next 6 blocks should fail
GRANT ALL ON TABLE histacl_history TO periods_acl_3; -- fail
ERROR: cannot grant DELETE to "histacl_history"; history objects are read-only
CONTEXT: PL/pgSQL function periods.health_checks() line 120 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 138 at RAISE
GRANT SELECT ON TABLE histacl_history TO periods_acl_3; -- fail
ERROR: cannot grant SELECT directly to "histacl_history"; grant SELECT to "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 125 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 143 at RAISE
REVOKE ALL ON TABLE histacl_history FROM periods_acl_1; -- fail
ERROR: cannot revoke SELECT directly from "histacl_history", revoke SELECT from "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 237 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 255 at RAISE
TABLE show_acls ORDER BY sort_order;
sort_order | schema_name | object_name | object_type | grantee | privilege_type
------------+-------------+----------------------------+-------------+---------------+----------------
Expand All @@ -407,13 +407,13 @@ TABLE show_acls ORDER BY sort_order;

GRANT ALL ON TABLE histacl_with_history TO periods_acl_3; -- fail
ERROR: cannot grant DELETE to "histacl_with_history"; history objects are read-only
CONTEXT: PL/pgSQL function periods.health_checks() line 120 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 138 at RAISE
GRANT SELECT ON TABLE histacl_with_history TO periods_acl_3; -- fail
ERROR: cannot grant SELECT directly to "histacl_with_history"; grant SELECT to "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 125 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 143 at RAISE
REVOKE ALL ON TABLE histacl_with_history FROM periods_acl_1; -- fail
ERROR: cannot revoke SELECT directly from "histacl_with_history", revoke SELECT from "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 237 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 255 at RAISE
TABLE show_acls ORDER BY sort_order;
sort_order | schema_name | object_name | object_type | grantee | privilege_type
------------+-------------+----------------------------+-------------+---------------+----------------
Expand All @@ -434,13 +434,13 @@ TABLE show_acls ORDER BY sort_order;

GRANT ALL ON FUNCTION histacl__as_of(timestamp with time zone) TO periods_acl_3; -- fail
ERROR: cannot grant EXECUTE directly to "histacl__as_of(timestamp with time zone)"; grant SELECT to "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 125 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 143 at RAISE
GRANT EXECUTE ON FUNCTION histacl__as_of(timestamp with time zone) TO periods_acl_3; -- fail
ERROR: cannot grant EXECUTE directly to "histacl__as_of(timestamp with time zone)"; grant SELECT to "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 125 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 143 at RAISE
REVOKE ALL ON FUNCTION histacl__as_of(timestamp with time zone) FROM periods_acl_1; -- fail
ERROR: cannot revoke EXECUTE directly from "histacl__as_of(timestamp with time zone)", revoke SELECT from "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 237 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 255 at RAISE
TABLE show_acls ORDER BY sort_order;
sort_order | schema_name | object_name | object_type | grantee | privilege_type
------------+-------------+----------------------------+-------------+---------------+----------------
Expand All @@ -461,13 +461,13 @@ TABLE show_acls ORDER BY sort_order;

GRANT ALL ON FUNCTION histacl__between(timestamp with time zone, timestamp with time zone) TO periods_acl_3; -- fail
ERROR: cannot grant EXECUTE directly to "histacl__between(timestamp with time zone,timestamp with time zone)"; grant SELECT to "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 125 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 143 at RAISE
GRANT EXECUTE ON FUNCTION histacl__between(timestamp with time zone, timestamp with time zone) TO periods_acl_3; -- fail
ERROR: cannot grant EXECUTE directly to "histacl__between(timestamp with time zone,timestamp with time zone)"; grant SELECT to "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 125 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 143 at RAISE
REVOKE ALL ON FUNCTION histacl__between(timestamp with time zone, timestamp with time zone) FROM periods_acl_1; -- fail
ERROR: cannot revoke EXECUTE directly from "histacl__between(timestamp with time zone,timestamp with time zone)", revoke SELECT from "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 237 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 255 at RAISE
TABLE show_acls ORDER BY sort_order;
sort_order | schema_name | object_name | object_type | grantee | privilege_type
------------+-------------+----------------------------+-------------+---------------+----------------
Expand All @@ -488,13 +488,13 @@ TABLE show_acls ORDER BY sort_order;

GRANT ALL ON FUNCTION histacl__between_symmetric(timestamp with time zone, timestamp with time zone) TO periods_acl_3; -- fail
ERROR: cannot grant EXECUTE directly to "histacl__between_symmetric(timestamp with time zone,timestamp with time zone)"; grant SELECT to "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 125 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 143 at RAISE
GRANT EXECUTE ON FUNCTION histacl__between_symmetric(timestamp with time zone, timestamp with time zone) TO periods_acl_3; -- fail
ERROR: cannot grant EXECUTE directly to "histacl__between_symmetric(timestamp with time zone,timestamp with time zone)"; grant SELECT to "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 125 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 143 at RAISE
REVOKE ALL ON FUNCTION histacl__between_symmetric(timestamp with time zone, timestamp with time zone) FROM periods_acl_1; -- fail
ERROR: cannot revoke EXECUTE directly from "histacl__between_symmetric(timestamp with time zone,timestamp with time zone)", revoke SELECT from "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 237 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 255 at RAISE
TABLE show_acls ORDER BY sort_order;
sort_order | schema_name | object_name | object_type | grantee | privilege_type
------------+-------------+----------------------------+-------------+---------------+----------------
Expand All @@ -515,13 +515,13 @@ TABLE show_acls ORDER BY sort_order;

GRANT ALL ON FUNCTION histacl__from_to(timestamp with time zone, timestamp with time zone) TO periods_acl_3; -- fail
ERROR: cannot grant EXECUTE directly to "histacl__from_to(timestamp with time zone,timestamp with time zone)"; grant SELECT to "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 125 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 143 at RAISE
GRANT EXECUTE ON FUNCTION histacl__from_to(timestamp with time zone, timestamp with time zone) TO periods_acl_3; -- fail
ERROR: cannot grant EXECUTE directly to "histacl__from_to(timestamp with time zone,timestamp with time zone)"; grant SELECT to "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 125 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 143 at RAISE
REVOKE ALL ON FUNCTION histacl__from_to(timestamp with time zone, timestamp with time zone) FROM periods_acl_1; -- fail
ERROR: cannot revoke EXECUTE directly from "histacl__from_to(timestamp with time zone,timestamp with time zone)", revoke SELECT from "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 237 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 255 at RAISE
TABLE show_acls ORDER BY sort_order;
sort_order | schema_name | object_name | object_type | grantee | privilege_type
------------+-------------+----------------------------+-------------+---------------+----------------
Expand Down
40 changes: 20 additions & 20 deletions expected/acl_1.out
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ TABLE show_acls ORDER BY sort_order;

GRANT SELECT, UPDATE ON TABLE fpacl__for_portion_of_p TO periods_acl_2; -- fail
ERROR: cannot grant SELECT directly to "fpacl__for_portion_of_p"; grant SELECT to "fpacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 125 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 143 at RAISE
GRANT SELECT, UPDATE ON TABLE fpacl TO periods_acl_2;
TABLE show_acls ORDER BY sort_order;
sort_order | schema_name | object_name | object_type | grantee | privilege_type
Expand All @@ -233,7 +233,7 @@ TABLE show_acls ORDER BY sort_order;

REVOKE UPDATE ON TABLE fpacl__for_portion_of_p FROM periods_acl_2; -- fail
ERROR: cannot revoke UPDATE directly from "fpacl__for_portion_of_p", revoke UPDATE from "fpacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 237 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 255 at RAISE
REVOKE UPDATE ON TABLE fpacl FROM periods_acl_2;
TABLE show_acls ORDER BY sort_order;
sort_order | schema_name | object_name | object_type | grantee | privilege_type
Expand Down Expand Up @@ -380,13 +380,13 @@ TABLE show_acls ORDER BY sort_order;
-- These next 6 blocks should fail
GRANT ALL ON TABLE histacl_history TO periods_acl_3; -- fail
ERROR: cannot grant DELETE to "histacl_history"; history objects are read-only
CONTEXT: PL/pgSQL function periods.health_checks() line 120 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 138 at RAISE
GRANT SELECT ON TABLE histacl_history TO periods_acl_3; -- fail
ERROR: cannot grant SELECT directly to "histacl_history"; grant SELECT to "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 125 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 143 at RAISE
REVOKE ALL ON TABLE histacl_history FROM periods_acl_1; -- fail
ERROR: cannot revoke SELECT directly from "histacl_history", revoke SELECT from "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 237 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 255 at RAISE
TABLE show_acls ORDER BY sort_order;
sort_order | schema_name | object_name | object_type | grantee | privilege_type
------------+-------------+----------------------------+-------------+---------------+----------------
Expand All @@ -407,13 +407,13 @@ TABLE show_acls ORDER BY sort_order;

GRANT ALL ON TABLE histacl_with_history TO periods_acl_3; -- fail
ERROR: cannot grant DELETE to "histacl_with_history"; history objects are read-only
CONTEXT: PL/pgSQL function periods.health_checks() line 120 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 138 at RAISE
GRANT SELECT ON TABLE histacl_with_history TO periods_acl_3; -- fail
ERROR: cannot grant SELECT directly to "histacl_with_history"; grant SELECT to "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 125 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 143 at RAISE
REVOKE ALL ON TABLE histacl_with_history FROM periods_acl_1; -- fail
ERROR: cannot revoke SELECT directly from "histacl_with_history", revoke SELECT from "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 237 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 255 at RAISE
TABLE show_acls ORDER BY sort_order;
sort_order | schema_name | object_name | object_type | grantee | privilege_type
------------+-------------+----------------------------+-------------+---------------+----------------
Expand All @@ -434,13 +434,13 @@ TABLE show_acls ORDER BY sort_order;

GRANT ALL ON FUNCTION histacl__as_of(timestamp with time zone) TO periods_acl_3; -- fail
ERROR: cannot grant EXECUTE directly to "histacl__as_of(timestamp with time zone)"; grant SELECT to "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 125 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 143 at RAISE
GRANT EXECUTE ON FUNCTION histacl__as_of(timestamp with time zone) TO periods_acl_3; -- fail
ERROR: cannot grant EXECUTE directly to "histacl__as_of(timestamp with time zone)"; grant SELECT to "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 125 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 143 at RAISE
REVOKE ALL ON FUNCTION histacl__as_of(timestamp with time zone) FROM periods_acl_1; -- fail
ERROR: cannot revoke EXECUTE directly from "histacl__as_of(timestamp with time zone)", revoke SELECT from "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 237 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 255 at RAISE
TABLE show_acls ORDER BY sort_order;
sort_order | schema_name | object_name | object_type | grantee | privilege_type
------------+-------------+----------------------------+-------------+---------------+----------------
Expand All @@ -461,13 +461,13 @@ TABLE show_acls ORDER BY sort_order;

GRANT ALL ON FUNCTION histacl__between(timestamp with time zone, timestamp with time zone) TO periods_acl_3; -- fail
ERROR: cannot grant EXECUTE directly to "histacl__between(timestamp with time zone,timestamp with time zone)"; grant SELECT to "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 125 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 143 at RAISE
GRANT EXECUTE ON FUNCTION histacl__between(timestamp with time zone, timestamp with time zone) TO periods_acl_3; -- fail
ERROR: cannot grant EXECUTE directly to "histacl__between(timestamp with time zone,timestamp with time zone)"; grant SELECT to "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 125 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 143 at RAISE
REVOKE ALL ON FUNCTION histacl__between(timestamp with time zone, timestamp with time zone) FROM periods_acl_1; -- fail
ERROR: cannot revoke EXECUTE directly from "histacl__between(timestamp with time zone,timestamp with time zone)", revoke SELECT from "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 237 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 255 at RAISE
TABLE show_acls ORDER BY sort_order;
sort_order | schema_name | object_name | object_type | grantee | privilege_type
------------+-------------+----------------------------+-------------+---------------+----------------
Expand All @@ -488,13 +488,13 @@ TABLE show_acls ORDER BY sort_order;

GRANT ALL ON FUNCTION histacl__between_symmetric(timestamp with time zone, timestamp with time zone) TO periods_acl_3; -- fail
ERROR: cannot grant EXECUTE directly to "histacl__between_symmetric(timestamp with time zone,timestamp with time zone)"; grant SELECT to "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 125 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 143 at RAISE
GRANT EXECUTE ON FUNCTION histacl__between_symmetric(timestamp with time zone, timestamp with time zone) TO periods_acl_3; -- fail
ERROR: cannot grant EXECUTE directly to "histacl__between_symmetric(timestamp with time zone,timestamp with time zone)"; grant SELECT to "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 125 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 143 at RAISE
REVOKE ALL ON FUNCTION histacl__between_symmetric(timestamp with time zone, timestamp with time zone) FROM periods_acl_1; -- fail
ERROR: cannot revoke EXECUTE directly from "histacl__between_symmetric(timestamp with time zone,timestamp with time zone)", revoke SELECT from "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 237 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 255 at RAISE
TABLE show_acls ORDER BY sort_order;
sort_order | schema_name | object_name | object_type | grantee | privilege_type
------------+-------------+----------------------------+-------------+---------------+----------------
Expand All @@ -515,13 +515,13 @@ TABLE show_acls ORDER BY sort_order;

GRANT ALL ON FUNCTION histacl__from_to(timestamp with time zone, timestamp with time zone) TO periods_acl_3; -- fail
ERROR: cannot grant EXECUTE directly to "histacl__from_to(timestamp with time zone,timestamp with time zone)"; grant SELECT to "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 125 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 143 at RAISE
GRANT EXECUTE ON FUNCTION histacl__from_to(timestamp with time zone, timestamp with time zone) TO periods_acl_3; -- fail
ERROR: cannot grant EXECUTE directly to "histacl__from_to(timestamp with time zone,timestamp with time zone)"; grant SELECT to "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 125 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 143 at RAISE
REVOKE ALL ON FUNCTION histacl__from_to(timestamp with time zone, timestamp with time zone) FROM periods_acl_1; -- fail
ERROR: cannot revoke EXECUTE directly from "histacl__from_to(timestamp with time zone,timestamp with time zone)", revoke SELECT from "histacl" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 237 at RAISE
CONTEXT: PL/pgSQL function periods.health_checks() line 255 at RAISE
TABLE show_acls ORDER BY sort_order;
sort_order | schema_name | object_name | object_type | grantee | privilege_type
------------+-------------+----------------------------+-------------+---------------+----------------
Expand Down
Loading

0 comments on commit 58e30e5

Please sign in to comment.