Re: BUG #13783: 'create database test owner testowner' as 'postgres' leaves test.public owned by postgres

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: BUG #13783: 'create database test owner testowner' as 'postgres' leaves test.public owned by postgres
Дата
Msg-id CAKFQuwbuQnLkA_sQHECg7az5vcvS79L9i_nEG48p5ss6UkHz2Q@mail.gmail.com
обсуждение исходный текст
Ответ на BUG #13783: 'create database test owner testowner' as 'postgres' leaves test.public owned by postgres  (xelah-postgresql@xelah.com)
Ответы Re: BUG #13783: 'create database test owner testowner' as 'postgres' leaves test.public owned by postgres
Список pgsql-bugs
On Tue, Nov 24, 2015 at 5:12 AM, <xelah-postgresql@xelah.com> wrote:

>
> 'CREATE DATABASE .. OWNER ..' creates a database owned by the correct use=
r,
> but containing a schema apparently owned by the user running 'CREATE
> DATABASE'. This causes us a problem when our test code tries to 'DROP
> SCHEMA
> public CASCADE' (as a way of clearing the database) as the database owner=
.
>

=E2=80=8B
This is not a bug and
=E2=80=8Bis =E2=80=8B
not going to be changed.

You need to choose one of the many other ways to accomplish your goal.

The specific behavior is that the template1 database which is being used as
a template (by default) has a public schema owned by the bootstrap
(postgres typically) user.  The create database commands clones the
template database exactly as it is defined.  The documentation covers this
dynamic in considerable detail.

You can clone "template0" or add "DROP SCHEMA" or "ALTER SCHEMA" to your
script if you want the final result to not look like template1.

David J.

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

Предыдущее
От: xelah-postgresql@xelah.com
Дата:
Сообщение: BUG #13783: 'create database test owner testowner' as 'postgres' leaves test.public owned by postgres
Следующее
От: Tom Lane
Дата:
Сообщение: Re: BUG #13783: 'create database test owner testowner' as 'postgres' leaves test.public owned by postgres