Postgresql errors after upgrading Orthanc to latest version

I just upgraded Orthanc to latest version from a very old version and the logs showed the db scheme upgrade went fine but since then no new study instances are being stored with the following error appearing any time a new instance comes in:

I0822 12:47:11.474980          DICOM-3 PluginsManager.cpp:161] (plugins) PostgreSQL: An active PostgreSQL transaction was dismissed
E0822 12:47:11.481980          DICOM-3 PluginsManager.cpp:153] Exception in database back-end: Error with the database engine
I0822 12:47:11.488981          DICOM-3 PluginsManager.cpp:161] (plugins) Cannotrollback a non-existing transaction
E0822 12:47:11.494981          DICOM-3 PluginsManager.cpp:153] Exception in database back-end: Bad sequence of calls
I0822 12:47:11.501982          DICOM-3 StatelessDatabaseOperations.cpp:543] Cannot rollback transaction: Bad sequence of calls
E0822 12:47:11.511982          DICOM-3 StoreScp.cpp:198] Exception while storing DICOM: Error with the database engine
I0822 12:47:11.519983          DICOM-3 main.cpp:353] Incoming Store request from AET FDR-CSL on IP 192.168.1.46, calling AET ETHOSMED-PACS
I0822 12:47:12.329029          DICOM-3 FilesystemStorage.cpp:126] Creating attachment "14de1556-a714-4ee3-9064-15d4d073e6e7" of "DICOM" type
I0822 12:47:12.372031          DICOM-3 FilesystemStorage.cpp:156] Created attachment "14de1556-a714-4ee3-9064-15d4d073e6e7" (1.43MB in 43.00ms = 278.34Mbps)
E0822 12:47:12.385032          DICOM-3 PluginsManager.cpp:153] PostgreSQL error: ERROR:  INSERT has more expressions than target columns LINE 1: ...NTO AttachedFiles VALUES($1, $2, $3, $4, $5, $6, $7, $8, $9)

Iā€™m on Postgresql version 13.6 and the latest version of Orthanc.

Config file?

Please see below

{

 "TransactionMode" : "ReadCommitted",
  "PostgreSQL" : {
    "EnableIndex" : true,
    "EnableStorage" : false,
    "Host" : "127.0.0.1",
    "Port" : 5432,
    "Database" : "hvclinic_ort2",
    "Username" : "postgres",
    "Password" : "hvclinicpacs577",
    "TransactionMode" : "ReadCommitted"

  },

  "Name" : "HVCLINIC PACS",

  "StorageDirectory" : "D:\\PACSIMAGEDATA2",

  "StorageCompression" : false,

  "MaximumStorageSize" : 0,

  "MaximumPatientCount" : 0,

  "MaximumStorageMode" : "Recycle",

  "MaximumStorageCacheSize" : 128,

  "LuaScripts" : [
  ],

  "LuaHeartBeatPeriod" : 0,

  "Plugins" : [ "C:\\hvclinic PACS\\Plugins" ],

  "ConcurrentJobs" : 0,

  "JobsEngineThreadsCount" : {
    "ResourceModification": 0     
  },

  "HttpServerEnabled" : true,

  "OrthancExplorerEnabled" : true,

  "HttpPort" : 8042,

  "HttpDescribeErrors" : true,

  "HttpCompressionEnabled" : true,

  "WebDavEnabled" : false,

  "WebDavDeleteAllowed" : false,

  "WebDavUploadAllowed" : true,

  "DicomServerEnabled" : true,

  "DicomAet" : "HVCLINIC-PACS",

  "DicomCheckCalledAet" : false,

  "DicomPort" : 4242,

  "DefaultEncoding" : "Latin1",

  "AcceptedTransferSyntaxes" : [ "1.2.840.10008.1.*" ],

  "UnknownSopClassAccepted" : false,

  "DicomScpTimeout" : 30,

  "RemoteAccessAllowed" : true,

  "SslEnabled" : false,

  "SslCertificate" : "certificate.pem",

  "SslMinimumProtocolVersion" : 4,

  "SslVerifyPeers" : false,

  "SslTrustedClientCertificates" : "trustedClientCertificates.pem",

  "RegisteredUsers" : {
     "hvclinicpacs" : "hvclinicpacs577"
  },

  "DicomTlsEnabled" : false,

  "DicomTlsRemoteCertificateRequired" : false,

  "DicomAlwaysAllowEcho" : true,

  "DicomAlwaysAllowStore" : false,

  "DicomAlwaysAllowFind" : false,

  "DicomAlwaysAllowFindWorklist" : false,

  "DicomAlwaysAllowGet" : false,

  "DicomAlwaysAllowMove" : false,

  "DicomCheckModalityHost" : false,

  "DicomModalities" : {

	"local" : [ "hvclinic-PACS", "127.0.0.1", 4242 ],
       "WEASISQR" : [ "WEASIS_QR", "127.0.0.1", 11113 ],
       "ohif" : [ "OHIFDCM", "localhost", 3000 ],
       "CT" : [ "CT9693AG", "192.168.1.21", 104 ]
  },

  "DicomModalitiesInDatabase" : false,

  "DicomEchoChecksFind" : false,

  "DicomScuTimeout" : 10,

  "DicomScuPreferredTransferSyntax" : "1.2.840.10008.1.2.1",

  "DicomThreadsCount" : 10,

  "OrthancPeers" : {

  },

  "OrthancPeersInDatabase" : false,

  "HttpProxy" : "",

  "HttpVerbose" : false,

  "HttpTimeout" : 60,

  "HttpsVerifyPeers" : true,

  "HttpsCACertificates" : "C:\\hvclinic PACS\\Configuration\\ca-certificates.crt",

  "UserMetadata" : {

  },

  "UserContentType" : {

  },

  "StableAge" : 60,

  "StrictAetComparison" : false,

  "StoreMD5ForAttachments" : true,

  "LimitFindResults" : 0,

  "LimitFindInstances" : 0,

  "LogExportedResources" : false,

  "KeepAlive" : true,

  "KeepAliveTimeout" : 1,

  "TcpNoDelay" : true,

  "HttpThreadsCount" : 50,

  "StoreDicom" : true,

  "DicomAssociationCloseDelay" : 5,

  "QueryRetrieveSize" : 100,

  "CaseSensitivePN" : false,

  "LoadPrivateDictionary" : true,

  "Dictionary" : {

  },

  "SynchronousCMove" : true,

  "JobsHistorySize" : 10,

  "SaveJobs" : true,

  "OverwriteInstances" : false,

  "MediaArchiveSize" : 10,

  "StorageAccessOnFind" : "Always",

  "MetricsEnabled" : false,

  "ExecuteLuaEnabled" : false,

  "RestApiWriteToFileSystemEnabled": true,

  "HttpRequestTimeout" : 30,

  "DefaultPrivateCreator" : "",

  "StorageCommitmentReportsSize" : 100,

  "TranscodeDicomProtocol" : true,

  "BuiltinDecoderTranscoderOrder" : "After",

  "IngestTranscoding" : "1.2.840.10008.1.2.4.90",   

  "IngestTranscodingOfUncompressed" : true,

  "IngestTranscodingOfCompressed" : true,

  "DicomLossyTranscodingQuality" : 90,

  "SyncStorageArea" : false,

  "MallocArenaMax" : 5,

  "DeidentifyLogs" : true,

  "DeidentifyLogsDicomVersion" : "2021b",

  "MaximumPduLength" : 16384,

  "CheckRevisions" : false,

  "SynchronousZipStream" : true,

  "ZipLoaderThreads": 0,

  "Warnings" : {

    "W001_TagsBeingReadFromStorage": false,

    "W002_InconsistentDicomTagsInDb": false
  }

}

What was your previous PostgreSQL plugin version ?

If it was 3.3, then there is an issue and part of the upgrade is not executed correctly. You may then try to run the upgrade manually as explained in this note

1 Like