Re: Q: extract database name from directory dump
От | John R Pierce |
---|---|
Тема | Re: Q: extract database name from directory dump |
Дата | |
Msg-id | 56E48CC9.4080403@hogranch.com обсуждение исходный текст |
Ответ на | Re: Q: extract database name from directory dump (Karsten Hilbert <Karsten.Hilbert@gmx.net>) |
Ответы |
Re: Q: extract database name from directory dump
pg_dump crashing |
Список | pgsql-general |
On 3/12/2016 12:59 PM, Karsten Hilbert wrote: > Another option that comes to mind is > > pg_restore -l $DUMPDIR | grep dbname: | cut -f 7 -d ' ' -s > > but that is quite fragile on the > > -f 7 -d ' ' > > side of things but that's another question. starting with... pg_dump -Fd -f junky "databasename" I think... pg_restore -l junky | awk '/^;\wdbname: (.*)/{print $3}' is more robust. but it fails on a database name with an embedded space (yes, these are valid). pg_restore -l junky | grep 'dbname:' | head -1 | sed 's/^; *dbname: //' should work even for dbnames with embedded spaces. the head -1 is just in case there the data 'dbname:' occurs in the database somewhere. -- john r pierce, recycling bits in santa cruz
В списке pgsql-general по дате отправления: