Slightly better testing for pg_ctl(1)'s -w...

From: Sean Chittenden <chitt(at)speakeasy(dot)net>
To: PostgreSQL-patches <pgsql-patches(at)postgresql(dot)org>
Subject: Slightly better testing for pg_ctl(1)'s -w...
Date: 2004-10-10 06:24:21
Message-ID: 05D5F896-1A85-11D9-BF1B-000A95C705DC@speakeasy.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

pg_ctl(1)'s -w option works well if the default user can automatically
authenticate without any user intervention. The attached patch checks
the error message to see if it's asking for a password. The theory
being that if it's asking for a password, the backend is up. I'm not
entirely happy with the fact that I'm dependent on the error message
text, but I couldn't easily figure out a better way to test this via
libpq(3), so I'm not too unhappy... it's just not elegant. This patch
does not encompass all possible scenarios for the backend being up, but
CONNECTION_BAD being set in libpq(3). Regardless, it's a start and
hopefully someone can apply this. I also cleaned up a small memory
leak when a connection is bad (PGconn not being free(3)'ed). -sc

% pg_ctl -w start && psql
waiting for postmaster to start....done
postmaster started
test=>

Attachment Content-Type Size
patch.txt text/plain 1.7 KB

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Sean Chittenden 2004-10-10 06:27:39 Casting INT4 to BOOL...
Previous Message Bruce Momjian 2004-10-09 22:08:19 Re: cast pid_t to int when using *printf