From: Holger Jakobs <holger@jakobs.com>
To: pgsql-admin@lists.postgresql.org
Subject: Re: Create Read only user
Date: Fri, 22 Jan 2021 21:09:44 +0100
Message-ID: <9e9f3cd6-bd51-29b3-887e-c3af2db91f54@jakobs.com> (raw)
In-Reply-To: <87bldgbv9r.fsf@gmail.com>
References: <CALhHtcA5CYQU0SLU673qAdZiixAJJ8GF2ZEJV7YSiq03h5W-jw@mail.gmail.com>
<87bldgbv9r.fsf@gmail.com>
Yes, the PUBLIC schema is a remnant from times when no schemas were
used, but all table were created in the database itself. This was the
case in the early 7.x versions.
There are still some applications around which have no notion of a
schema. This is especially true for those which are expected work with a
bunch of very weak database servers, for instance with MySQL.
MySQL/MariaDB only have schemas and just a single database per server
instance. They call their schemas databases, though.
If you have an application which is made to run with PostgreSQL, the
configuration will allow to specify a schema to put the tables into.
Otherwise, you'll have to set up a search path including the schema you
want the database objects to end up in. You can configure the default
search path for the application user appropriately using ALTER ROLE.
Hardly any application forces the PUBLIC schema to be around. It's just
that the PUBLIC schema exists in the template1 database with full access
to PUBLIC and thus will exist in every database you create, unless you
remove it (or change the access rights) in the template1 database. And
the default search path includes PUBLIC.
Actually, this only exists to be compatible with *very* old applications.
Regards,
Holger
--
Holger Jakobs, Bergisch Gladbach, Tel. +49-178-9759012
Attachments:
OpenPGP_signature (application/pgp-signature, 202B) download
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-admin@postgresql.org
Cc: holger@jakobs.com, pgsql-admin@lists.postgresql.org
Subject: Re: Create Read only user
In-Reply-To: <9e9f3cd6-bd51-29b3-887e-c3af2db91f54@jakobs.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox