comparison PostgreSQL/Plugins/PrepareIndex.sql @ 431:7c1fe5d6c12c pg-transactions

PG: IncrementGlobalProperty
author Alain Mazy <am@osimis.io>
date Thu, 07 Dec 2023 12:13:43 +0100
parents a7f0f27fe33c
children 8b7c1c423367
comparison
equal deleted inserted replaced
430:f1f3c5554283 431:7c1fe5d6c12c
132 --RAISE NOTICE 'Delete resource %', old.parentId; 132 --RAISE NOTICE 'Delete resource %', old.parentId;
133 INSERT INTO DeletedResources VALUES (old.resourceType, old.publicId); 133 INSERT INTO DeletedResources VALUES (old.resourceType, old.publicId);
134 134
135 -- http://stackoverflow.com/a/11299968/881731 135 -- http://stackoverflow.com/a/11299968/881731
136 IF EXISTS (SELECT 1 FROM Resources WHERE parentId = old.parentId) THEN 136 IF EXISTS (SELECT 1 FROM Resources WHERE parentId = old.parentId) THEN
137 -- Signal that the deleted resource has a remaining parent 137 -- Signal that the deleted resource has a remaining parent
138 -- (a parent that must not be deleted but whose LastUpdate must be updated)
138 INSERT INTO RemainingAncestor 139 INSERT INTO RemainingAncestor
139 SELECT resourceType, publicId FROM Resources WHERE internalId = old.parentId; 140 SELECT resourceType, publicId FROM Resources WHERE internalId = old.parentId;
140 ELSE 141 ELSE
141 -- Delete a parent resource when its unique child is deleted 142 -- Delete a parent resource when its unique child is deleted
142 DELETE FROM Resources WHERE internalId = old.parentId; 143 DELETE FROM Resources WHERE internalId = old.parentId;