Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3eb9a5e

Browse files
committed
Fix pg_dump/pg_restore to emit REFRESH MATERIALIZED VIEW commands last.
Because we push all ACL (i.e. GRANT/REVOKE) restore steps to the end,materialized view refreshes were occurring while the permissions onreferenced objects were still at defaults. This led to failures if,say, an MV owned by user A reads from a table owned by user B, evenif B had granted the necessary privileges to A. We've had multiplecomplaints about that type of restore failure, most recently fromJordan Gigov.The ideal fix for this would be to start treating ACLs as dependency-sortable objects, rather than hard-wiring anything about their dump order(the existing approach is a messy kluge dating to commitdc0e76c).But that's going to be a rather major change, and it certainly wouldn'tlead to a back-patchable fix. As a short-term solution, convert theexisting two-pass hack (ie, normal objects then ACLs) to a three-pass hack,ie, normal objects then ACLs then matview refreshes. Because this happensin RestoreArchive(), it will also fix the problem when restoring from anexisting archive-format dump.(Note this means that if a matview refresh would have failed under thepermissions prevailing at dump time, it'll fail during restore as well.We'll define that as user error rather than something we should tryto work around.)To avoid performance loss in parallel restore, we need the matviewrefreshes to still be parallelizable. Hence, clean things up enoughso that both ACLs and matviews are handled by the parallel restoreinfrastructure, instead of reverting back to serial restore for ACLs.There is still a final serial step, but it shouldn't normally have todo anything; it's only there to try to recover if we get stuck due tosome problem like unresolved circular dependencies.Patch by me, but it owes something to an earlier attempt by Kevin Grittner.Back-patch to 9.3 where materialized views were introduced.Discussion:https://postgr.es/m/28572.1500912583@sss.pgh.pa.us
1 parent9a3b5d3 commit3eb9a5e

File tree

2 files changed

+264
-129
lines changed

2 files changed

+264
-129
lines changed

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp