BUG #14247: COMMENT is restored on wrong database

From: pgerber(at)tocco(dot)ch
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #14247: COMMENT is restored on wrong database
Date: 2016-07-13 13:21:22
Message-ID: 20160713132122.1410.44923@wrigleys.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-hackers

The following bug has been logged on the website:

Bug reference: 14247
Logged by: Peter Gerber
Email address: pgerber(at)tocco(dot)ch
PostgreSQL version: 9.5.3
Operating system: Linux
Description:

Comments on a databases are restored on the database named the same the dump
was made from. For instance, if a dump is made from a database called
'source_db' and restored into 'target_db' the comment is restored on the
wrong database, 'source_db'.

How to reproduce:
1: CREATE DATABASE source_db;
2. COMMENT ON DATABASE source_db IS 'test';
3. pg_dump -Fc -d source_db -f dump;
4. COMMENT ON DATABASE source_db IS null;
5. CREATE DATABASE target_db;
6. pg_restore -d target_db dump
7. SELECT datname, description FROM pg_shdescription
JOIN pg_database ON objoid = pg_database.oid
WHERE datname in ('source_db', 'target_db');
datname | description
-----------+-------------
source_db | test
(1 row)

Also, if pg_dump is done without -Fc it contains this line:
COMMENT ON DATABASE dbrefactoring_new_210 IS 'test';

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message David G. Johnston 2016-07-13 13:59:12 Re: BUG #14247: COMMENT is restored on wrong database
Previous Message Tomasz Ostrowski 2016-07-13 11:10:45 Invalid indexes should not consume update overhead

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2016-07-13 13:25:08 Re: Simplifying the interface of UpdateMinRecoveryPoint
Previous Message Amit Kapila 2016-07-13 12:57:46 Re: Re: [COMMITTERS] pgsql: Avoid extra locks in GetSnapshotData if old_snapshot_threshold <