]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2773] Update DB creation for Postgres 15+
authorSlawek Figiel <slawek@isc.org>
Tue, 21 May 2024 16:50:15 +0000 (18:50 +0200)
committerSlawek Figiel <slawek@isc.org>
Thu, 23 May 2024 12:17:45 +0000 (14:17 +0200)
doc/devel/unit-tests.dox
doc/sphinx/arm/admin.rst

index 42d06439fe0556bd9169e0bf0507bd453a224718..e289c92b246f1cec89df13418c0b46a2fa009174 100644 (file)
@@ -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,
index 7be0fbbfbce213162229d86dc81e770f2bc4003e..3031cb92be29fe081c59c400e277be29eca5340d 100644 (file)
@@ -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