diff options
author | Slawek Figiel <slawek@isc.org> | 2024-05-21 18:50:15 +0200 |
---|---|---|
committer | Slawek Figiel <slawek@isc.org> | 2024-05-23 14:17:45 +0200 |
commit | 808f97e13ddd06972ea36281340330ab34b7c912 (patch) | |
tree | 500a08857706fbf59b30f568f9dfd6f7c08ad309 | |
parent | [#3290] docs - ha-scopes warning (diff) | |
download | kea-808f97e13ddd06972ea36281340330ab34b7c912.tar.xz kea-808f97e13ddd06972ea36281340330ab34b7c912.zip |
[#2773] Update DB creation for Postgres 15+
-rw-r--r-- | doc/devel/unit-tests.dox | 6 | ||||
-rw-r--r-- | doc/sphinx/arm/admin.rst | 33 |
2 files changed, 38 insertions, 1 deletions
diff --git a/doc/devel/unit-tests.dox b/doc/devel/unit-tests.dox index 42d06439fe..e289c92b24 100644 --- a/doc/devel/unit-tests.dox +++ b/doc/devel/unit-tests.dox @@ -286,6 +286,10 @@ postgres=# CREATE DATABASE keatest; CREATE DATABASE postgres=# GRANT ALL PRIVILEGES ON DATABASE keatest TO keatest; GRANT +postgres=# \c keatest +You are now connected to database "keatest" as user "postgres". +keatest=# GRANT ALL PRIVILEGES ON SCHEMA public TO keatest; +GRANT postgres=# \q @endverbatim @@ -295,6 +299,8 @@ postgres=# \q However, this only affects tables which exist when the privileges are granted. To ensure that the user has specific privileges to tables dynamically created by the unit tests, the default schema privileges must be altered. + In the Postgres 15.0+, you need to explicitly grant privileges to access to + the ``public`` schema. The following example demonstrates how to create the user <i>keatest_readonly</i>, which has SELECT privilege to the tables within the <i>keatest</i> database, diff --git a/doc/sphinx/arm/admin.rst b/doc/sphinx/arm/admin.rst index 7be0fbbfbc..3031cb92be 100644 --- a/doc/sphinx/arm/admin.rst +++ b/doc/sphinx/arm/admin.rst @@ -462,7 +462,7 @@ the files may be located in ``/var/lib/pgsql/data``. The first task is to create both the database and the user under which the servers will access it. A number of steps are required: -1. Log into PostgreSQL as "root": +1. Log into PostgreSQL as "postgres": .. code-block:: console @@ -489,6 +489,10 @@ which the servers will access it. A number of steps are required: CREATE ROLE postgres=# GRANT ALL PRIVILEGES ON DATABASE database-name TO user-name; GRANT + postgres=# \c database-name + You are now connected to database "database-name" as user "postgres". + postgres=# GRANT ALL PRIVILEGES ON SCHEMA public TO user-name; + GRANT postgres=# 4. Exit PostgreSQL: @@ -587,6 +591,33 @@ The PostgreSQL database schema can be upgraded using the same tool and commands as described in :ref:`mysql-upgrade`, with the exception that the "pgsql" database backend type must be used in the commands. +If you upgraded your Postgres database from a version prior 15.0, you need to grant +the additional privileges to the user: + +First, log into PostgreSQL as "postgres": + + .. code-block:: console + + $ sudo -u postgres psql -d database-name -U postgres + Enter password: + postgres=# + +Next, grant the access to the ``public`` schema. + + .. code-block:: psql + + postgres=# GRANT ALL PRIVILEGES ON SCHEMA public TO user-name; + GRANT + postgres=# + +Now, quit the PostgreSQL client: + + .. code-block:: psql + + postgres=# \q + Bye + $ + Use the following command to check the current schema version: .. code-block:: console |