PostgreSQL Bugs

Collected from the PG bugs email list.

Bug ID16243
PG Version10.10
OSsuse
Opened2020-02-04 06:18:01+00
Reported byzeng
StatusNew

Body of first available message related to this bug follows.

The following bug has been logged on the website:

Bug reference:      16243
Logged by:          zeng
Email address:      (redacted)
PostgreSQL version: 10.10
Operating system:   suse
Description:        

Hi,

When take the pg restore, both backup action and restore use non-super role
user “cm” which is the owner of the DB. During pg_restore, the log show some
errors such as "could not execute query: ERROR:  must be owner of extension
plpgsql", "could not execute query: ERROR:  must be owner of extension
plpgsql". I have some confusion. Are they correct behavior? If not, how to
avoid them? thanks in advance.

Thanks
zeng


Reproduce steps:
1.	Create DB cm db
CREATE DATABASE cmdb OWNER cm WITH TEMPLATE = template0;
GRANT ALL PRIVILEGES ON DATABASE cmdb to cm;

2.	Insert the data 
pgbench -i -h 127.0.01 -U cm -s 20 -d cmdb
3.	Take backup action for the cmdb.
pg_dump -h 127.0.0.1 -U cm -d cmdb -p 5432 -Fc -f bk_1
4.	Take restore action for the cmdb.
pg_restore -h 127.0.0.1 -U cm -d cmdb bk_1 -c -v


log:
$:/var/lib/postgresql/data/bk # pg_restore -h 127.0.0.1 -U cm -d cmdb bk_1
-c -v
pg_restore: connecting to database for restore
Password:
pg_restore: dropping CONSTRAINT pgbench_tellers pgbench_tellers_pkey
pg_restore: dropping CONSTRAINT pgbench_branches pgbench_branches_pkey
pg_restore: dropping CONSTRAINT pgbench_accounts pgbench_accounts_pkey
pg_restore: dropping TABLE DATA pgbench_tellers
pg_restore: dropping TABLE DATA pgbench_history
pg_restore: dropping TABLE DATA pgbench_branches
pg_restore: dropping TABLE DATA pgbench_accounts
pg_restore: dropping TABLE pgbench_tellers
pg_restore: dropping TABLE pgbench_history
pg_restore: dropping TABLE pgbench_branches
pg_restore: dropping TABLE pgbench_accounts
pg_restore: dropping COMMENT EXTENSION plpgsql
pg_restore: dropping EXTENSION plpgsql
pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 1; 3079 13628 EXTENSION
plpgsql
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner
of extension plpgsql
    Command was: DROP EXTENSION plpgsql;

pg_restore: dropping COMMENT SCHEMA public
pg_restore: dropping SCHEMA public
pg_restore: [archiver (db)] Error from TOC entry 3; 2615 2200 SCHEMA public
postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner
of schema public
    Command was: DROP SCHEMA public;

pg_restore: creating SCHEMA "public"
pg_restore: [archiver (db)] could not execute query: ERROR:  schema "public"
already exists
    Command was: CREATE SCHEMA public;



pg_restore: creating COMMENT "SCHEMA public"
pg_restore: [archiver (db)] Error from TOC entry 3520; 0 0 COMMENT SCHEMA
public postgres
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner
of schema public
    Command was: COMMENT ON SCHEMA public IS 'standard public schema';



pg_restore: creating EXTENSION "plpgsql"
pg_restore: creating COMMENT "EXTENSION plpgsql"
pg_restore: [archiver (db)] Error from TOC entry 3521; 0 0 COMMENT EXTENSION
plpgsql
pg_restore: [archiver (db)] could not execute query: ERROR:  must be owner
of extension plpgsql
    Command was: COMMENT ON EXTENSION plpgsql IS 'PL/pgSQL procedural
language';



pg_restore: creating TABLE "public.pgbench_accounts"
pg_restore: creating TABLE "public.pgbench_branches"
pg_restore: creating TABLE "public.pgbench_history"
pg_restore: creating TABLE "public.pgbench_tellers"
pg_restore: processing data for table "public.pgbench_accounts"
pg_restore: processing data for table "public.pgbench_branches"
pg_restore: processing data for table "public.pgbench_history"
pg_restore: processing data for table "public.pgbench_tellers"
pg_restore: creating CONSTRAINT "public.pgbench_accounts
pgbench_accounts_pkey"
pg_restore: creating CONSTRAINT "public.pgbench_branches
pgbench_branches_pkey"
pg_restore: creating CONSTRAINT "public.pgbench_tellers
pgbench_tellers_pkey"
WARNING: errors ignored on restore: 5

Messages

DateAuthorSubject
2020-02-04 06:18:01+00PG Bug reporting formBUG #16243: non super user take pg_restore found some errors.
2020-02-04 16:27:38+00Tom LaneRe: BUG #16243: non super user take pg_restore found some errors.