Re: [BUGS] BUG #14817: pg_dumpall is not generating create databasestatements - Mailing list pgsql-bugs

From Alexander Scott
Subject Re: [BUGS] BUG #14817: pg_dumpall is not generating create databasestatements
Date
Msg-id 8684b139-1776-7e4b-7cb9-1a73de3be274@yuscott.co.uk
Whole thread Raw
In response to Re: [BUGS] BUG #14817: pg_dumpall is not generating create database statements  ("David G. Johnston" <david.g.johnston@gmail.com>)
List pgsql-bugs

David,

Thanks for the answer.  That makes perfect sense and I feel slightly embarassed that that did not occur to me.

As far as I am concerned, there is a perfectly logic explanation for the behaviour so case closed!

Alex

On 15/09/2017 17:08, David G. Johnston wrote:
On Fri, Sep 15, 2017 at 8:20 AM, <alex@yuscott.co.uk> wrote:
The following bug has been logged on the website:

Bug reference:      14817
Logged by:          Alexander Scott
Email address:      alex@yuscott.co.uk
PostgreSQL version: 9.6.5
Operating system:   CentOS Linux release 7.3.1611 (Core)
Description:

I have a fresh install of 9.6.5 with a default postgres database.

I have REVOKED ALL FROM public, created a couple of roles and 1 initial
user.

I wanted to take a dump of the entire cluster to store but the output file
lacks create statements for the databases.

Working as intended (at least per code comments in pg_dumpall.c @1464) - the only databases that exist (postgres, template0, template1) in your installation are the default databases.  pg_dumpall is assuming that the target cluster that you will be restoring into will already contain them (and a freshly created cluster should) and so decides it does not need to create them itself.

You will probably need to describe a more complete use case, with an actual failure, in order to convince someone to change this.

David J.


pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: [BUGS] BUG #14815: event trigger in extension
Next
From: Bruce Momjian
Date:
Subject: Re: [BUGS] BUG #14798: postgres user superuser changed