]> git.ipfire.org Git - thirdparty/postgresql.git/commit
Add test for MAINTAIN permission with pg_restore_extended_stats()
authorMichael Paquier <michael@paquier.xyz>
Mon, 26 Jan 2026 07:32:33 +0000 (16:32 +0900)
committerMichael Paquier <michael@paquier.xyz>
Mon, 26 Jan 2026 07:32:33 +0000 (16:32 +0900)
commitd9abd9e1050db4c2fcdce6fcd8dc0ede6769db16
tree29e15f5ccea50febcae68c0650b1fd658e08fd2b
parent114e84c532d1493bbabcaf8ab79a3f1830e8bf9e
Add test for MAINTAIN permission with pg_restore_extended_stats()

Like its cousin functions for the restore of relation and attribute
stats, pg_restore_extended_stats() needs to be run by a user that is the
database owner or has MAINTAIN privileges on the table whose stats are
restored.  This commit adds a regression test ensuring that MAINTAIN is
required when calling the function.  This test also checks that a
ShareUpdateExclusive lock is taken on the table whose stats are
restored.

This has been split from the commit that has introduced
pg_restore_extended_stats(), for clarity.

Author: Corey Huinker <corey.huinker@gmail.com>
Reviewed-by: Chao Li <li.evan.chao@gmail.com>
Reviewed-by: Michael Paquier <michael@paquier.xyz>
Discussion: https://postgr.es/m/CADkLM=dpz3KFnqP-dgJ-zvRvtjsa8UZv8wDAQdqho=qN3kX0Zg@mail.gmail.com
src/test/regress/expected/stats_import.out
src/test/regress/sql/stats_import.sql