changeset 1201:dc447fda1f64

PG Schema and ApplicationName
author Alain Mazy <am@orthanc.team>
date Mon, 20 Oct 2025 16:54:26 +0200
parents cfd5b7689c72
children 83449cf704d8 0af2c56ea46c
files Sphinx/source/plugins/postgresql.rst
diffstat 1 files changed, 19 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/Sphinx/source/plugins/postgresql.rst	Mon Oct 20 16:53:46 2025 +0200
+++ b/Sphinx/source/plugins/postgresql.rst	Mon Oct 20 16:54:26 2025 +0200
@@ -72,8 +72,10 @@
       "TransactionMode": "ReadCommitted",    // New in release 6.0 - new default value in 7.0
       "EnableVerboseLogs": false,            // New in release 6.0
       "HousekeepingInterval": 1,             // New in release 7.0
-      "AllowInconsistentChildCounts": false  // New in release 7.2,
-      "UseDynamicConnectionPool": false      // New in release 9.0
+      "AllowInconsistentChildCounts": false, // New in release 7.2
+      "UseDynamicConnectionPool": false,     // New in release 9.0
+      "Schema": "public",                    // New in release 9.0+ (not released yet)
+      "ApplicationName": "",                 // New in release 9.0+ (not released yet)
     },
     "Plugins" : [
       "/home/user/orthanc-databases/BuildPostgreSQL/libOrthancPostgreSQLIndex.so",
@@ -199,6 +201,20 @@
   and ``ReadCommitted`` that is available only from release 6.0 and is the default
   value starting from version 7.0.  See below.
 
+* ``Schema`` has been added in the release 9.0+ (not released yet).  By default,
+  Orthanc uses the ``public`` default schema.  If you wish to use another schema,
+  you must create it before starting Orthanc; Orthanc will not create it.
+  Note that Orthanc might try to install the ``pg_trgm`` extension in the ``public``
+  schema so you should make sure that the ``Username`` also has access to the ``public``
+  schema or that you install the ``pg_trgm`` extension manually in the public schema.
+  Internals: plugin calls ``SET search_path TO $schema`` when opening a new connection
+  to the DB.
+
+* ``ApplicationName`` has been added in the release 9.0+ (not released yet).
+  This value is copied in the ``application_name`` argument in the connection string.  
+  This name is used to identify the origin of queries in statistics and logs in 
+  the PostgreSQL server.
+
 * The PostgreSQL plugin supports the :ref:`revision mechanism
   <revisions>` to protect metadata and attachments from concurrent
   modifications.
@@ -373,7 +389,7 @@
 manually and then, restart the Orthanc containers with the newest version of the plugin.
 
 To upgrade manually from revision 1 to revision 6, one might run this procedure on the existing DB (note: make
-sur to select the correct DB and schema (Orthanc is using the default ``public`` shema))::
+sur to select the correct DB and schema (By default, Orthanc is using the ``public`` shema))::
 
   $ wget https://orthanc.uclouvain.be/hg/orthanc-databases/raw-file/default/PostgreSQL/Plugins/SQL/Upgrades/Rev1ToRev2.sql
   $ wget https://orthanc.uclouvain.be/hg/orthanc-databases/raw-file/default/PostgreSQL/Plugins/SQL/Upgrades/Rev2ToRev3.sql