Re: Q: extract database name from directory dump - Mailing list pgsql-general

From Karsten Hilbert
Subject Re: Q: extract database name from directory dump
Date
Msg-id 20160312212806.GH1688@hermes.hilbert.loc
Whole thread Raw
In response to Re: Q: extract database name from directory dump  (Melvin Davidson <melvin6925@gmail.com>)
List pgsql-general
On Sat, Mar 12, 2016 at 04:17:07PM -0500, Melvin Davidson wrote:

> BTW, other than the obvious of including the name in path or file, if you
> are referring to previous/existing dumps

I do.

> grep -i some_dump_file 'CREATE DATABASE'

That will not work (directly) because the dump is in
directory format.

> If nothing is found, then the dump can be applied to ANY database.

Since one can create an SQL dump from the directory dump the
above becomes possible by appropriate use of

    pg_restore -C ... | grep CREATE DATABASE

This is, indeed, the option (after pg_restore -l | grep ...)
I consider least fragile.

Karsten
--
GPG key ID E4071346 @ eu.pool.sks-keyservers.net
E167 67FD A291 2BEA 73BD  4537 78B9 A9F9 E407 1346


pgsql-general by date:

Previous
From: Karsten Hilbert
Date:
Subject: Re: Q: extract database name from directory dump
Next
From: Chris Ruprecht
Date:
Subject: Re: OS X 10.11.3, psql, bus error 10, 9.5.1