comparison PostgreSQL/Plugins/InsertOrUpdateMetadata.sql @ 436:f16faa1fdc46 pg-transactions

InsertOrUpdateMetadata function + UpdateAndGetStatistics
author Alain Mazy <am@osimis.io>
date Fri, 15 Dec 2023 17:11:26 +0100
parents
children
comparison
equal deleted inserted replaced
435:326f8304daa1 436:f16faa1fdc46
1 CREATE OR REPLACE FUNCTION InsertOrUpdateMetadata(resourceIds BIGINT[],
2 metadataTypes INTEGER[],
3 metadataValues TEXT[],
4 revisions INTEGER[])
5 RETURNS VOID AS $body$
6 BEGIN
7 FOR i IN 1 .. ARRAY_LENGTH(resourceIds, 1) LOOP
8 -- RAISE NOTICE 'Parameter %: % % %', i, resourceIds[i], metadataTypes[i], metadataValues[i];
9 INSERT INTO Metadata VALUES(resourceIds[i], metadataTypes[i], metadataValues[i], revisions[i]) ON CONFLICT DO NOTHING;
10 END LOOP;
11
12 END;
13 $body$ LANGUAGE plpgsql;