You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pg_restore: while PROCESSING TOC:
pg_restore: from TOC entry 3392; 0 0 ACL TABLE test_history postgres
pg_restore: error: could not execute query: ERROR: cannot revoke SELECT directly from "public.test_history", revoke SELECT from "public.test" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 255 at RAISE
Command was: REVOKE ALL ON TABLE public.test_history FROM postgres;
GRANT SELECT ON TABLE public.test_history TO postgres;
pg_restore: from TOC entry 3393; 0 0 ACL TABLE test_with_history postgres
pg_restore: error: could not execute query: ERROR: cannot revoke SELECT directly from "public.test_with_history", revoke SELECT from "public.test" instead
CONTEXT: PL/pgSQL function periods.health_checks() line 255 at RAISE
Command was: REVOKE ALL ON TABLE public.test_with_history FROM postgres;
GRANT SELECT ON TABLE public.test_with_history TO postgres;
pg_restore: warning: errors ignored on restore: 2
From now on, I can't change privileges.
If I run grant select on test to postgres; I get
ERROR: cannot grant DELETE to "test_history"; history objects are read-only
CONTEXT: PL/pgSQL function periods.health_checks() line 138 at RAISE
In the CROSS JOIN is always COALESCE(c.relacl, acldefault('r', c.relowner)).
When pg_restore creates the table test_history, the table only has the default acl belonging to the owner (in the query c.relacl is null, so COALESCE returns acldefault('r', c.relowner) which is {postgres=arwdDxt/postgres}).
The query returns:
table_name
object_name
object_type
privilege_type
base_privilege_type
grantee
history_or_portion
on_base_table
test
test__as_of(timestamp with time zone)
f
EXECUTE
SELECT
10
h
t
test
test__between(timestamp with time zone,timestamp with time zone)
f
EXECUTE
SELECT
10
h
t
test
test__between_symmetric(timestamp with time zone,timestamp with time zone)
f
EXECUTE
SELECT
10
h
t
test
test__from_to(timestamp with time zone,timestamp with time zone)
f
EXECUTE
SELECT
10
h
t
test
test_history
r
DELETE
DELETE
10
h
t
test
test_history
r
INSERT
INSERT
10
h
t
test
test_history
r
REFERENCES
REFERENCES
10
h
t
test
test_history
r
SELECT
SELECT
10
h
t
test
test_history
r
TRIGGER
TRIGGER
10
h
t
test
test_history
r
TRUNCATE
TRUNCATE
10
h
t
test
test_history
r
UPDATE
UPDATE
10
h
t
test
test_with_history
v
DELETE
DELETE
10
h
t
test
test_with_history
v
INSERT
INSERT
10
h
t
test
test_with_history
v
REFERENCES
REFERENCES
10
h
t
test
test_with_history
v
SELECT
SELECT
10
h
t
test
test_with_history
v
TRIGGER
TRIGGER
10
h
t
test
test_with_history
v
TRUNCATE
TRUNCATE
10
h
t
test
test_with_history
v
UPDATE
UPDATE
10
h
t
Because all of the default acl privilege types are returned,
(r.object_type, r.privilege_type) NOT IN (('r', 'SELECT'), ('v', 'SELECT'), ('f', 'EXECUTE'))
THEN
RAISE EXCEPTION 'cannot grant % to "%"; history objects are read-only',
r.privilege_type, r.object_name;
END IF;
raises the exception.
pg_restore can't GRANT the SELECT privilege, so c.relacl will always be null and the health_check() trigger will block every GRANT. Even for tables which don't have periods.
The text was updated successfully, but these errors were encountered:
I tried the following on PostgreSQL 13+14 on Windows 10.
I created a new database and ran:
Everything works fine.
Then I dump and restore the database:
pg_dump.exe --file=periods_test.dump --format=custom periods_test psql -c "DROP DATABASE periods_test;" pg_restore -d postgres -C periods_test.dump
pg_restore raises these errors:
From now on, I can't change privileges.
If I run
grant select on test to postgres;
I getI think the reason for this is in
periods/periods--1.2.sql
Lines 3397 to 3459 in 9bb3df9
In the CROSS JOIN is always
COALESCE(c.relacl, acldefault('r', c.relowner))
.When pg_restore creates the table test_history, the table only has the default acl belonging to the owner (in the query
c.relacl
is null, so COALESCE returnsacldefault('r', c.relowner)
which is {postgres=arwdDxt/postgres}).The query returns:
Because all of the default acl privilege types are returned,
periods/periods--1.2.sql
Lines 3447 to 3453 in 9bb3df9
raises the exception.
pg_restore can't GRANT the SELECT privilege, so
c.relacl
will always be null and the health_check() trigger will block every GRANT. Even for tables which don't have periods.The text was updated successfully, but these errors were encountered: