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

From: Graham Leggett <minfrin(at)sharp(dot)fm>
To: pinker <pinker(at)onet(dot)eu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Is there a "right" way to test if a database is empty?
Date: 2018-01-17 16:04:01
Message-ID: 5B09CFC6-EE9D-4483-84B6-FB1393CD3041@sharp.fm
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 17 Jan 2018, at 6:01 PM, pinker <pinker(at)onet(dot)eu> wrote:

> I always do: \l+ and then you can compare the size: new_one | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | | 7869 kB | pg_default | template0 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +| 7869 kB | pg_default | | | | | postgres=CTc/postgres | | | template1 | postgres | UTF8 | en_US.UTF-8 | en_US.UTF-8 | =c/postgres +| 7869 kB | pg_default

What I am after is something scriptable and data safe.

The size isn’t something I would be comfortable relying on.

Regards,
Graham

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Corey Huinker 2018-01-17 16:09:19 Re: CREATE ROUTINE MAPPING
Previous Message pinker 2018-01-17 16:01:35 Re: Is there a "right" way to test if a database is empty?