Re: BUG #15168: "pg_isready -d" effectively ignores given database name
От
David G. Johnston
Тема
Re: BUG #15168: "pg_isready -d" effectively ignores given database name
Дата
Msg-id
CAKFQuwbuc2_cLvakSwOyqbnUx7uXKNpt392YU1fpToL=1DoPvw@mail.gmail.com
Ответ на
Список
Дерево обсуждения
BUG #15168: "pg_isready -d" effectively ignores given database name PG Bug reporting form <noreply@postgresql.org>
Re: BUG #15168: "pg_isready -d" effectively ignores given database name "David G. Johnston" <david.g.johnston@gmail.com>
Re: BUG #15168: "pg_isready -d" effectively ignores given databasename jake <jakelist@zoho.com>
Re: BUG #15168: "pg_isready -d" effectively ignores given databasename jake <jakelist@zoho.com>
Re: BUG #15168: "pg_isready -d" effectively ignores given database name "David G. Johnston" <david.g.johnston@gmail.com>
On Tuesday, April 24, 2018, jake <jakelist@zoho.com> wrote:
Well, after fleshing out your command, I got:psql -tc "select 1 from pg_catalog.pg_database where datname='snowdrift';" | grep -qw 1That looks more complicated than the StackOverflow solution:psql -lt | cut -f1 -d \| | grep -qw <db-name>Or at least it's longer. Hmm. I guess personal taste is a big factor here.Jake T.
If your psql connection is logging you onto the snowdrift database checking for its existence explicitly seems pointless...otherwise, yes, using the -l option (which connects you, generally, to the default postgres database) in psql is going to be the better way to check for database presence since -l basically invokes the pg_database query for you.
David J.
В списке pgsql-bugs по дате отправления
От: jake
Дата:
От: Kyotaro HORIGUCHI
Дата: