Release 10.3 (2026-08-19)
=========================

Minimum plugin SDK (for build): 1.12.5
Optimal plugin SDK (for build): 1.13.0
Minimum Orthanc runtime: 1.12.5
Optimal Orthanc runtime: 1.13.0

Minimal Postgresql Server version: 9
Optimal Postgresql Server version: 11+

Changes:
* Wait until Orthanc has finalized its startup before executing the DB HOUSEKEEPING task to avoid 
  "Plugin trying to call the database during its initialization" errors.


Release 10.2 (2026-06-23)
=========================

Changes:
* Internal changes only:
  - Enable linking with libpq18 (Ubuntu 26.04).
  - Show more details when an internal error occurs.


Release 10.1 (2026-04-14)
=========================

Changes:
* In tools/find, filtering against "LabelsConstraint": "None" with an empty "Labels" list
  now returns all resources that do not have any labels attached instead of returning all resources.


Release 10.0 (2025-12-02)
=========================

DB schema revision: 10 (skipped version 7, 8 and 9 to sync revision with plugin version)
Minimum plugin SDK (for build): 1.12.5
Optimal plugin SDK (for build): 1.12.10
Minimum Orthanc runtime: 1.12.5
Optimal Orthanc runtime: 1.12.10

Minimal Postgresql Server version: 9
Optimal Postgresql Server version: 11+

Changes:
* New configuration "Schema" (default value: 'public') to allow Orthanc
  to use another schema.  Note that, if you are not using the default 'public'
  value, you must create the schema manually before starting Orthanc and you
  must make sure that the user has access to it.
  Note that Orthanc might try to install the pg_trgm extension in the 'public'
  schema so you should make sure that the user also has access to the 'public'
  schema or that you install the pg_trgm extension manually in the public schema.
  The plugin now calls 'SET search_path TO $schema' when opening a new connection
  to the DB.
* New configuration "ApplicationName" (default value is empty) that 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.
* SDK: Added support for ReserveQueueValue and AcknowledgeQueueValue (new in SDK 1.12.10)

Maintenance:
* Added a new primary key column in the InvalidChildCounts and GlobalIntegersChanges
  tables.  This new column is required for pg_repack to be able to reclaim space on
  these tables.


Release 9.0 (2025-08-13)
========================

DB schema revision: 6
Minimum plugin SDK (for build): 1.12.5
Optimal plugin SDK (for build): 1.12.9
Minimum Orthanc runtime: 1.12.5
Optimal Orthanc runtime: 1.12.9

Minimal Postgresql Server version: 9
Optimal Postgresql Server version: 11+

* New configuration "UseDynamicConnectionPool" to dynamically create/release
  connections to the PostgreSQL database.  
  When this option is disabled (default), the connections are created once
  at the start of the plugin and are kept alive for the whole execution.
  Using the dynamic mode enables cleanup of some temporary tables that
  could otherwise accumulate dead rows.
  When using a dynamic pool, connections are released either after 60 seconds
  of being idle or one hour after their creation.
* New metrics "orthanc_index_active_connections" showing the current number
  of active connections.
* Added support for AuditLogs.  The PostgreSQL plugin is listening to audit logs
  that other plugins can emit and is storing them in the SQL Database.
  They can be browsed through the API route /plugins/postgresql/audit-logs?user-id=x&since=1&limit=100&log-data-format=json&from-timestamp=2025-08-11T11:25:55.639Z&to-timestamp=2025-08-11T14:25:55.639Z&resource-id=y&action=z

Maintenance:
* Optimized the CreateInstance SQL query.
* Optimized UpdateStatistics and DeleteResource as described in 
  https://discourse.orthanc-server.org/t/increase-in-cpu-usage-of-database-after-update-to-orthanc-1-12-7/6057/6
* Internals: 
  - The PatientRecyclingOrder has been refactored and is now stored in
    Patient metadata (18: IsProtected, 19: PatientRecyclingOrder)



Release 8.0 (2025-06-16)
========================

DB schema revision: 5

Minimum plugin SDK (for build): 1.12.5
Optimal plugin SDK: 1.12.8

Minimum Orthanc runtime: 1.12.5
Optimal Orthanc runtime: 1.12.8

Minimal Postgresql Server version: 9
Optimal Postgresql Server version: 11+


* Added support for customData in AttachedFiles
* Added support for key-value stores and queues.



Release 7.2 (2025-02-27)
========================

DB schema revision: 4
Minimum plugin SDK (for build): 1.12.5
Optimal plugin SDK (for build): 1.12.5
Minimum Orthanc runtime: 1.12.5
Optimal Orthanc runtime: 1.12.6

Minimal Postgresql Server version: 9
Optimal Postgresql Server version: 11+


Maintenance:
* Optimized the SQL query that is maintaining the childCount
  when new instances are ingested.
* New configuration "AllowInconsistentChildCounts" to speed
  up childCount computation.  If set to true, childCount values
  of recently ingested resources will be incorrect until the next
  execution of the DB Housekeeping thread (defined by "HousekeepingInterval"
  - default value is 1s)
* Fixed high memory usage due to caching of too many
  prepared SQL statement when using since & limit.
* Removed duplicate comparison in find SQL queries.
* Now returning results when e.g, ordering instances against a metadata they don't have.



Release 7.1 (2025-01-23)
========================

DB schema revision: 3
Minimum plugin SDK (for build): 1.12.5
Optimal plugin SDK (for build): 1.12.5
Minimum Orthanc runtime: 1.12.5
Optimal Orthanc runtime: 1.12.6

Minimal Postgresql Server version: 9
Optimal Postgresql Server version: 11+


* Disable DB Housekeeping thread on ReadOnly systems.
* Find: Implemented support for searching for child resources fulfilling 
  a dicom tag constraint.  This solves the search against ModalitiesInStudy
  that was broken when used with pagination.


Release 7.0 (2024-12-18)
========================

DB schema revision: 3
Minimum plugin SDK (for build): 1.12.5
Optimal plugin SDK (for build): 1.12.5
Minimum Orthanc runtime: 1.12.5
Optimal Orthanc runtime: 1.12.5

Minimal Postgresql Server version: 9
Optimal Postgresql Server version: 11+

* WARNING: An Index is being replaced to improve performance.  The creation
  of the new index can take some time (we have observed 3 minutes on a
  DB with 70M instances).  Orthanc will not be available during the
  creation of this index.  If needed, you can create it manually before installing
  the new plugin by executing this SQL command (extracted from
  https://orthanc.uclouvain.be/hg/orthanc-databases/file/default/PostgreSQL/Plugins/SQL/Upgrades/Rev2ToRev3.sql):

    CREATE INDEX IF NOT EXISTS ChildrenIndex2 ON Resources USING btree (parentId ASC NULLS LAST) INCLUDE (publicId, internalId)

* WARNING: A new column has been added in the resources table when upgrading to this version.  A new thread
  is populating this new table and might consume DB bandwitdh and CPU until it has populated the column.  
  The creation of the new column might also take a few minutes the first time you launch this version.

* WARNING: when upgrading very large databases, make sur to read this section of the Orthanc book:
  https://orthanc.uclouvain.be/book/plugins/postgresql.html#note-for-large-databases-and-multiple-orthanc-instances

* Added support for ExtendedChanges introduced in Orthanc 1.12.5
  enabling new get arguments (type & to) in the /changes API route.
* Added support for ExtendedFind introduced in Orthanc 1.12.5
  enabling new filtering and ordering options in /tools/find API route.
* Performance optimizations:
  - reduced the number of round-trips between Orthanc and the PostgreSQL server:
    - replaced numerous small queries by a single large query in /tools/find.
    - reduced the number of queries when ingesting new instances.
  - using more prepared SQL statements

* Fixed a memory leak when executing non cached SQL statements (rarely used)
* New default values for configurations:
  - "IndexConnectionsCount": 50
  - "TransactionMode": "ReadCommitted"
* Introduced a new thread to perform DB Housekeeping at regular interval.  
  E.g: This avoids very long update times in case you don't call /statistics 
  for a long period.  The execution interval of this thread can be configured 
  through "HousekeepingInterval" (default: 1s).
* Fix updates from plugin version 3.3 to latest version
* Fix a bug introduced in 6.0 in the PatientRecyclingOrder when using patient protection.


Release 6.2 (2024-03-25)
========================

DB schema revision: 2
Minimum plugin SDK (for build): 1.12.3
Minimum Orthanc runtime: 1.12.3

* Fix check of Orthanc runtime version


Release 6.1 (2024-02-14)
========================

DB schema revision: 2

* Fix handling of MaximumStorageSize & MaximumPatientCount.


Release 6.0 (2024-02-08)
========================

DB schema revision: 2

* The DB schema has been updated to Revision 2.  If you need to reinstall the previous
  version of the plugin, you should run this script:
  https://orthanc.uclouvain.be/hg/orthanc-databases/file/tip/PostgreSQL/Plugins/SQL/Downgrades/Rev2ToRev1.sql
* Transaction Mode:
  Introduced a new configuration "TransactionMode" to select the transaction isolation level.
  Allowed values: "Serializable", "ReadCommitted".
  The "Serializable" mode was the only available value up to now.  It is still the default
  value now.
  The "ReadCommitted" is possible now due to rewrites of SQL queries and notably improves
  the Orthanc ability to ingest data from multiple sources in parallel.
* New "EnableVerboseLogs" configuration to show SQL statements being executed.


Release 5.1 (2023-06-27)
========================

DB schema revision: 1

* Optimization of LookupResources mainly used in tools/find, C-Find and QIDO-RS.

Release 5.0 (2023-04-15)
========================

* Added support for labels
* Compatibility with Orthanc SDK 1.12.0 (communications between the
  Orthanc core and the database plugin using Google Protocol Buffers)
* Upgraded dependencies for static builds (notably on Windows and LSB):
  - openssl 3.1.0


Release 4.0 (2021-04-22)
========================

* New option "IndexConnectionsCount" to control how many simultaneous
  connections to the PostgreSQL database are used by the index plugin
* Support of revisions for metadata and attachments
* Support of multiple readers/writers, by handling retries from Orthanc SDK 1.9.2
* Support of range reads for the storage area, from Orthanc SDK 1.9.0
* Fix issue #193 (LSB binaries crash with PostgreSQL + SSL) by changeset
  in OrthancFramework: https://orthanc.uclouvain.be/hg/orthanc/rev/9a9118406484
* Fix issue #151 (Storage failures when running with two instances and PG_LOCK=false)


Release 3.3 (2020-12-14)
========================

* Added an advisory lock to avoid race conditions during database setup
* Added "MaximumConnectionRetries" & "ConnectionRetryInterval" to configure 
  the retries when connecting to the DB at startup
* Support of dynamic linking against the system-wide Orthanc framework library
* Upgraded dependencies for static builds (notably on Windows and LSB):
  - openssl 1.1.1g
  - libpq 13.1 (replacing libpq 9.6.1)


Release 3.2 (2019-03-01)
========================

* Explicit deallocation of prepared statements


Release 3.1 (2019-02-08)
========================

* Fix build on Debian Buster
* Remove "ASSERT" in SQL for compatibility with older releases of PostgreSQL
* Implementation of new extensions: LookupResourceAndParent and GetAllMetadata
* Performance: Defining option "TCP_NODELAY" if libpq is linked statically


Release 3.0 (2019-01-21)
========================

* New configuration option: "EnableSsl"
* Database optimizations by implementing new primitives of Orthanc SDK 1.5.2
* Fix issue 105 (Unable to connect to PostgreSQL database using SSL)
* Fix Debian issue #906771 (Uncaught exception prevents db intialization
  (likely related to pg_trgm))
* Fix: Catching exceptions in destructors


Release 2.2 (2018-07-16)
========================

!! Important remark when upgrading from an older version of the plugin:

   The plugin will create a new index to improve search performance.
   This can take several minutes at the first Orthanc startup. Orthanc
   will not be available during this period. On a PostgreSQL database
   with 100,000 studies, we have observed that updating the index took
   around 10 minutes.

* Migration into the "orthanc-databases" repository
* Full refactoring to share code with MySQL
* Fix issue 41 (Additional range IdentifierConstraintType in Orthanc)
  !! This fix requires Orthanc version >= 1.4.0
* Fix issue 47 (Index improvements for PG plugin)
* Fix issue 76 (PG connection shall reconnect/retry in case it loses
  the connection to the server)


Release 2.1 (2018-04-20)
========================

* Running transactions in "Serializable" isolation level to avoid 
  inconsistencies if multiple Orthanc are writing to the same DB
* Upgrade to PostgreSQL 9.6.1 client library for static builds
* Performance warning if runtime debug assertions are turned on
* Fix issue 62 (use correct type for lo_read() value)
* Fix issue 63 (allow to connect without specifing username and/or port)
* Fix issue 68 (PostgreSQL plugin needs extra flags to compile)
* Resort to Orthanc framework
* Support of Linux Standard Base, OpenBSD and FreeBSD


Release 2.0 (2015-12-02)
========================

=> Minimum SDK version: 0.9.5 <=
=> Supported database versions: 5 (upgrade only) and 6 <=

* Support version 6 of the database schema
* The "value" column of tables "MainDicomTags" and "DicomIdentifiers" are now TEXT instead of BYTEA


Release 1.3 (2015-10-07)
========================

=> Minimum SDK version: 0.9.4 <=
=> Supported database versions: 5 <=

* Fix build with Orthanc plugin SDK 0.9.4
* Implementation of "GetAllPublicIdsWithLimit" extension
* Implementation of "UpgradeDatabase" extension


Release 1.2 (2015-08-02)
========================

=> Minimum SDK version: 0.9.1 <=

* Inject version information into Windows binaries
* CMake flag to prevent compiling the unit tests (if no PostgreSQL test server is available)
* Update to Boost 1.58.0 for static and Windows builds
* Support of OS X compilation


Release 1.1 (2015-07-03)
========================

* Fixes
* Support of Visual Studio 2008
* Support of FreeBSD thanks Mikhail <mp39590@gmail.com>


Release 1.0 (2015-02-27)
========================

* Use of advisory locks
* Support of connection URI in PostgreSQL
* Options "EnableIndex" and "EnableStorage" to explicitly enable PostgreSQL


2015-02-06
==========

* Initial release
