On Thu, Oct 6, 2016 at 8:04 PM, Heikki Linnakangas <hlinnaka(at)iki(dot)fi> wrote:
> On 10/05/2016 05:25 PM, xrensis(at)gmail(dot)com wrote:
>> - Is there a known interface to check if the database is up and fully
>> functional and ready for queries?
>
> The simplest way is to run a query with e.g. "psql -c 'select 1'", and see
> if it works.
>
> Note that you can also use "pg_ctl start -w" to have pg_ctl wait for the
> database to fully start up, before it returns.
That's one way. Have a look as well at pg_isready:
https://www.postgresql.org/docs/9.3/static/app-pg-isready.html
it is in 9.3, and is actually a wrapper of PQping(). Once it returns 0
as exit code, it means that the database is ready to accept incoming
connections.
--
Michael