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

Поиск
Список
Период
Сортировка
От hubert depesz lubaczewski
Тема Re: Is there a "right" way to test if a database is empty?
Дата
Msg-id 20180118110424.GA1012@depesz.com
обсуждение исходный текст
Ответ на Is there a "right" way to test if a database is empty?  (Graham Leggett <minfrin@sharp.fm>)
Список pgsql-hackers
On Wed, Jan 17, 2018 at 05:47:16PM +0200, Graham Leggett wrote:
> 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?

There is none, because it highly depends on how you'll define empty.

Please note that even directly after "create database x;" your db might
not be empty, if you had some things created earlier in template1.

Best regards,

depesz



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Amit Langote
Дата:
Сообщение: Re: [Sender Address Forgery]Re: [Sender Address Forgery]Re: [SenderAddress Forgery]Re: [HACKERS] path toward faster partition pruning
Следующее
От: Thomas Munro
Дата:
Сообщение: Re: [HACKERS] Planning counters in pg_stat_statements