Re: Q: extract database name from directory dump

From: Karsten Hilbert <Karsten(dot)Hilbert(at)gmx(dot)net>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Q: extract database name from directory dump
Date: 2016-03-12 22:13:59
Message-ID: 20160312221359.GJ1688@hermes.hilbert.loc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Mar 12, 2016 at 02:59:05PM -0700, David G. Johnston wrote:

> And a much more reasonable assumption would have been 9.5 - let the user
> complain if/when the advice doesn't work because they are on an unstated
> older release that doesn't support the feature in question.
>
> I guess the O/S would be needed for syntax purposes but the typical
> responder would simply provide an answer if whatever O/S shell they are
> familiar with and deal with the issue of making it work elsewhere if needed.
>
> It is, however, quite needed to report the version (and usually O/S) when
> posting to the -bugs list. This here is the -general list and the need to
> do so is generally not all that frequent though is appreciated as it makes
> giving targeted advice a bit easier.

Thanks but no worry. I am myself actually in favor of
providing sufficient information. So I did and took the
possibly (!) ever so slight chiding undertones (?) as a
lesson in humility :-))

Eventually, I went with

TARGET_DB=`pg_restore -C -s ${BACKUP}.dir | head -n 40 | grep -i "create database gnumed_v" | cut -f 3 -d " "`

which is intended to be used under

bash:
Installiert: 4.3-14+b1
Installationskandidat: 4.3-14+b1
Versionstabelle:
*** 4.3-14+b1 0
990 ftp://ftp.de.debian.org/debian/ stretch/main i386 Packages
500 ftp://ftp.de.debian.org/debian/ unstable/main i386 Packages
100 /var/lib/dpkg/status
4.3-11+b1 0
500 http://ftp.de.debian.org/debian/ jessie/main i386 Packages

Note that I changed the "head -1" to "head -n 40"

coreutils:
Installiert: 8.25-2
Installationskandidat: 8.25-2
Versionstabelle:
*** 8.25-2 0
990 ftp://ftp.de.debian.org/debian/ stretch/main i386 Packages
500 ftp://ftp.de.debian.org/debian/ unstable/main i386 Packages
100 /var/lib/dpkg/status
8.23-4 0
500 http://ftp.de.debian.org/debian/ jessie/main i386 Packages

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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2016-03-12 22:34:48 Re: OS X 10.11.3, psql, bus error 10, 9.5.1
Previous Message Peter J. Holzer 2016-03-12 22:11:14 Re: Unable to match same value in field.