Skip to content
Snippets Groups Projects
Commit b291af88 authored by Jorrit Schaap's avatar Jorrit Schaap
Browse files

SW-41: sql between is inclusive, but we want exclusive edges

parent 6293ff36
No related branches found
No related tags found
No related merge requests found
...@@ -297,7 +297,8 @@ BEGIN ...@@ -297,7 +297,8 @@ BEGIN
FOR intermediate_usage IN SELECT * FROM resource_allocation.resource_usage ru FOR intermediate_usage IN SELECT * FROM resource_allocation.resource_usage ru
WHERE ru.resource_id = new_claim.resource_id WHERE ru.resource_id = new_claim.resource_id
AND ru.status_id = new_claim.status_id AND ru.status_id = new_claim.status_id
AND ru.as_of_timestamp between new_claim.starttime and new_claim.endtime AND ru.as_of_timestamp > new_claim.starttime
AND ru.as_of_timestamp < new_claim.endtime
LOOP LOOP
UPDATE resource_allocation.resource_usage ru SET usage = intermediate_usage.usage + new_claim.claim_size UPDATE resource_allocation.resource_usage ru SET usage = intermediate_usage.usage + new_claim.claim_size
WHERE ru.id = intermediate_usage.id; WHERE ru.id = intermediate_usage.id;
...@@ -921,16 +922,6 @@ DECLARE ...@@ -921,16 +922,6 @@ DECLARE
BEGIN BEGIN
SELECT * from clock_timestamp() into proc_start; SELECT * from clock_timestamp() into proc_start;
-- IF TG_OP = 'INSERT' THEN
-- RAISE NOTICE 'before_claim_insertupdatedelete % %', TG_OP, NEW;
-- END IF;
-- IF TG_OP = 'UPDATE' THEN
-- RAISE NOTICE 'before_claim_insertupdatedelete % % %', TG_OP, OLD, NEW;
-- END IF;
-- IF TG_OP = 'DELETE' THEN
-- RAISE NOTICE 'before_claim_insertupdatedelete % %', TG_OP, OLD;
-- END IF;
--order of following steps is important, do not reorder the steps --order of following steps is important, do not reorder the steps
IF TG_OP = 'INSERT' OR TG_OP = 'UPDATE' THEN IF TG_OP = 'INSERT' OR TG_OP = 'UPDATE' THEN
IF NEW.starttime >= NEW.endtime THEN IF NEW.starttime >= NEW.endtime THEN
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment