Обсуждение: `DROP DATABASE RESTRICT` ?

Поиск
Список
Период
Сортировка

`DROP DATABASE RESTRICT` ?

От
Brennan Vincent
Дата:
Hello all,

I was wondering if there is some reason why Postgres doesn't support a
`RESTRICT` option that would refuse to drop a database if it contains
any schemas or objects, similarly to the semantics of `DROP SCHEMA
[...] RESTRICT`.

Is there a fundamental reason not to support it, or is it just that
nobody has implemented it yet?

Thanks
Brennan



Re: `DROP DATABASE RESTRICT` ?

От
"David G. Johnston"
Дата:
On Wed, Mar 4, 2020 at 6:17 PM Brennan Vincent <brennan@materialize.io> wrote:
Hello all,

I was wondering if there is some reason why Postgres doesn't support a
`RESTRICT` option that would refuse to drop a database if it contains
any schemas or objects, similarly to the semantics of `DROP SCHEMA
[...] RESTRICT`.

Is there a fundamental reason not to support it, or is it just that
nobody has implemented it yet?

Fundamentally you are not connected to the database you are dropping and so don't have access to the knowledge of whether its populated or not.  It also likely has at least an empty public schema...

David J.