Skip to content

Commit 808f97e

Browse files
committed
[#2773] Update DB creation for Postgres 15+
1 parent 7e36a43 commit 808f97e

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

doc/devel/unit-tests.dox

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,10 @@ postgres=# CREATE DATABASE keatest;
286286
CREATE DATABASE
287287
postgres=# GRANT ALL PRIVILEGES ON DATABASE keatest TO keatest;
288288
GRANT
289+
postgres=# \c keatest
290+
You are now connected to database "keatest" as user "postgres".
291+
keatest=# GRANT ALL PRIVILEGES ON SCHEMA public TO keatest;
292+
GRANT
289293
postgres=# \q
290294
@endverbatim
291295

@@ -295,6 +299,8 @@ postgres=# \q
295299
However, this only affects tables which exist when the privileges are granted.
296300
To ensure that the user has specific privileges to tables dynamically created
297301
by the unit tests, the default schema privileges must be altered.
302+
In the Postgres 15.0+, you need to explicitly grant privileges to access to
303+
the ``public`` schema.
298304

299305
The following example demonstrates how to create the user <i>keatest_readonly</i>,
300306
which has SELECT privilege to the tables within the <i>keatest</i> database,

doc/sphinx/arm/admin.rst

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -462,7 +462,7 @@ the files may be located in ``/var/lib/pgsql/data``.
462462
The first task is to create both the database and the user under
463463
which the servers will access it. A number of steps are required:
464464

465-
1. Log into PostgreSQL as "root":
465+
1. Log into PostgreSQL as "postgres":
466466

467467
.. code-block:: console
468468
@@ -489,6 +489,10 @@ which the servers will access it. A number of steps are required:
489489
CREATE ROLE
490490
postgres=# GRANT ALL PRIVILEGES ON DATABASE database-name TO user-name;
491491
GRANT
492+
postgres=# \c database-name
493+
You are now connected to database "database-name" as user "postgres".
494+
postgres=# GRANT ALL PRIVILEGES ON SCHEMA public TO user-name;
495+
GRANT
492496
postgres=#
493497
494498
4. Exit PostgreSQL:
@@ -587,6 +591,33 @@ The PostgreSQL database schema can be upgraded using the same tool and
587591
commands as described in :ref:`mysql-upgrade`, with the exception that the "pgsql"
588592
database backend type must be used in the commands.
589593

594+
If you upgraded your Postgres database from a version prior 15.0, you need to grant
595+
the additional privileges to the user:
596+
597+
First, log into PostgreSQL as "postgres":
598+
599+
.. code-block:: console
600+
601+
$ sudo -u postgres psql -d database-name -U postgres
602+
Enter password:
603+
postgres=#
604+
605+
Next, grant the access to the ``public`` schema.
606+
607+
.. code-block:: psql
608+
609+
postgres=# GRANT ALL PRIVILEGES ON SCHEMA public TO user-name;
610+
GRANT
611+
postgres=#
612+
613+
Now, quit the PostgreSQL client:
614+
615+
.. code-block:: psql
616+
617+
postgres=# \q
618+
Bye
619+
$
620+
590621
Use the following command to check the current schema version:
591622

592623
.. code-block:: console

0 commit comments

Comments
 (0)