Mercurial > hg > orthanc-databases
view PostgreSQL/Plugins/InsertOrUpdateMetadata.sql @ 437:d979f25e60cf pg-transactions
Re-organized DB creation/upgrade into standalone files
author | Alain Mazy <am@osimis.io> |
---|---|
date | Mon, 18 Dec 2023 18:50:01 +0100 |
parents | f16faa1fdc46 |
children |
line wrap: on
line source
CREATE OR REPLACE FUNCTION InsertOrUpdateMetadata(resourceIds BIGINT[], metadataTypes INTEGER[], metadataValues TEXT[], revisions INTEGER[]) RETURNS VOID AS $body$ BEGIN FOR i IN 1 .. ARRAY_LENGTH(resourceIds, 1) LOOP -- RAISE NOTICE 'Parameter %: % % %', i, resourceIds[i], metadataTypes[i], metadataValues[i]; INSERT INTO Metadata VALUES(resourceIds[i], metadataTypes[i], metadataValues[i], revisions[i]) ON CONFLICT DO NOTHING; END LOOP; END; $body$ LANGUAGE plpgsql;