Is there a "right" way to test if a database is empty?

From: Graham Leggett <minfrin(at)sharp(dot)fm>
To: PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Is there a "right" way to test if a database is empty?
Date: 2018-01-17 15:47:16
Message-ID: 71737871-79F4-4AA6-A393-05D05A9DFDF1@sharp.fm
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi all,

I need to test whether a database is empty, in other words “createdb” has been executed but no data of any kind appears in that database.

What is the correct postgresql way to do this?

Is there a pg_isempty command or equivalent somewhere?

Regards,
Graham

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2018-01-17 15:48:35 Re: master make check fails on Solaris 10
Previous Message Marina Polyakova 2018-01-17 15:46:13 Re: master make check fails on Solaris 10