Summary | pgsql create script fails |
Queue | Horde Base |
Queue Version | 3.3.3 |
Type | Bug |
State | Resolved |
Priority | 2. Medium |
Owners | Horde Developers (at) |
Requester | reg (at) debian (dot) org |
Created | 03/15/2009 (5952 days ago) |
Due | |
Updated | 03/26/2009 (5941 days ago) |
Assigned | 03/16/2009 (5951 days ago) |
Resolved | 03/26/2009 (5941 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | Yes |
State ⇒ Resolved
-- ALTER USER horde WITH PASSWORD 'pass';
CREATE DATABASE horde OWNER horde;
\c horde horde;
- the admin can always change this if they don't agree. Added to
3.3.4 and HEAD.
http://cvs.horde.org/diff.php/horde/scripts/sql/create.pgsql.sql?rt=horde&r1=1.1.10.22&r2=1.1.10.23&ty=u
http://cvs.horde.org/diff.php/horde/scripts/sql/create.pgsql.sql?rt=horde&r1=1.35&r2=1.36&ty=u
--------------------+----------+--------------------------------
public | postgres | {postgres=UC/postgres,=UC/postgres}
differently on our systems. The part "=UC/postgres" means public users
can Use (i.e., select) and Create on the public schema (and these
privileges have been granted by the user postgres). I've removed
create privileges for public users in my database. That's why it's
working for you and not for me.
By default, Postgres allows any account to login to any database and
create objects on the public schema. I suppose it's possible someone
may have gone a step further and configured their template database to
prevent public users from logging in at all.
I imagine a foolproof version of the script would look something like this:
CREATE USER horde;
-- ALTER USER horde WITH PASSWORD 'pass';
CREATE DATABASE horde OWNER horde;
\c horde horde;
Alternatively, if you don't want horde to own the database (I don't
know the security implications one way or the other):
CREATE DATABASE horde;
CREATE USER horde;
-- ALTER USER horde WITH PASSWORD 'pass';
GRANT CONNECT ON DATABASE horde TO horde;
\c horde
GRANT CREATE ON SCHEMA public TO horde;
SET ROLE horde;
I haven't test any of this, so you may want to play around and see
how/if this works.
| Description
--------------------+----------+-------------------------------------+----------------------------------
information_schema | postgres | {postgres=UC/postgres,=U/postgres} |
pg_catalog | postgres | {postgres=UC/postgres,=U/postgres}
| system catalog schema
pg_toast | postgres |
| reserved schema for TOAST tables
pg_toast_temp_1 | postgres | |
public | postgres | {postgres=UC/postgres,=UC/postgres}
| standard public schema
(5 rows)
postgres/SQL expert by any stretch of the imagination).
'\dn+' from your template1 database and post the output.
http://cvs.horde.org/diff.php/horde/scripts/sql/create.pgsql.sql?rt=horde&r1=1.1.10.21&r2=1.1.10.22&ty=u
Welcome to psql 8.3.6 (server 8.3.5), the PostgreSQL interactive terminal.
creating and switching to the horde database, it fails to create new
relations with error
"permission denied for schema public".
postgres/SQL expert by any stretch of the imagination).
script fails, the user is left the horde user and an empty horde
database.
http://cvs.horde.org/diff.php/horde/scripts/sql/create.pgsql.sql?rt=horde&r1=1.34&r2=1.35&ty=u
Assigned to
State ⇒ Assigned
State ⇒ Unconfirmed
Patch ⇒ Yes
Milestone ⇒
Queue ⇒ Horde Base
Summary ⇒ pgsql create script fails
Type ⇒ Bug
Priority ⇒ 2. Medium
I forward you a bug reported by a Debian user
(http://bugs.debian.org/508571) :
The create.pgsql.sql script fails (running postgresql 8.3.5). After
creating and switching to the horde database, it fails to create new
relations with error
"permission denied for schema public".
The script erroneously grants CREATE on the database, which only
allows creation of new schemas:
GRANT CREATE on DATABASE horde to horde;
\c horde horde;
The script should grant CREATE on the schema:
\c horde
GRANT CREATE ON SCHEMA public TO horde;
SET ROLE horde;
Also, the script should probably run inside a transaction. After the
script fails, the user is left the horde user and an empty horde
database.