From: | "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com> |
---|---|
To: | xelah-postgresql(at)xelah(dot)com |
Cc: | "pgsql-bugs(at)postgresql(dot)org" <pgsql-bugs(at)postgresql(dot)org> |
Subject: | Re: BUG #13783: 'create database test owner testowner' as 'postgres' leaves test.public owned by postgres |
Date: | 2015-11-24 21:56:56 |
Message-ID: | CAKFQuwbuQnLkA_sQHECg7az5vcvS79L9i_nEG48p5ss6UkHz2Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On Tue, Nov 24, 2015 at 5:12 AM, <xelah-postgresql(at)xelah(dot)com> wrote:
>
> 'CREATE DATABASE .. OWNER ..' creates a database owned by the correct user,
> 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.
>
β
This is not a bug and
βis β
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.
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2015-11-24 22:05:26 | Re: BUG #13783: 'create database test owner testowner' as 'postgres' leaves test.public owned by postgres |
Previous Message | pinker | 2015-11-24 17:31:26 | Re: pg_dump - wrong order with inheritance |