diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/README b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/README index bdb88dbe5682a3d23703aa6262862d42b0442ce8..9901f24b17de32645deb27e949cc9f94ef83369a 100644 --- a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/README +++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/README @@ -28,8 +28,12 @@ To create a fresh and empty RADB, follow the following steps. ssh scu199 * Obtain/adjust the relevant credentials. As lofarsys: cat ~/.lofar/dbcredentials/radb.ini +* Stop any services interacting with the radb: + supervisorctl -p 123 stop ra_services: * If you want a NEW database, create one (see radb.ini for the relevant parameters): (see create_database.sql) * Reinitialise the database (see radb.ini for the relevant parameters): psql -h $DBHOST $DATABASE -U $DBUSER -f create_and_populate_database.sql -W * Ignore all NOTICES. +* Stop any services interacting with the radb: + supervisorctl -p 123 start RA_Services: diff --git a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/add_functions_and_triggers.sql b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/add_functions_and_triggers.sql index 948dde1a8670a7ba3471cb8c51e92e6883a1df82..4ad59a10a6e38f27ec330af109152afde032072a 100644 --- a/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/add_functions_and_triggers.sql +++ b/SAS/ResourceAssignment/ResourceAssignmentDatabase/radb/sql/add_functions_and_triggers.sql @@ -561,7 +561,7 @@ BEGIN -- for performance reasons we repeat the common code here instead of wrapping the common code in a function --get all overlapping_claims, whether they cause a conflict or not. - CREATE TEMPORARY TABLE IF NOT EXISTS overlapping_claims + CREATE TEMPORARY TABLE overlapping_claims ON COMMIT DROP AS SELECT * FROM resource_allocation.resource_claim rc WHERE rc.resource_id = claim.resource_id @@ -626,7 +626,7 @@ BEGIN --RAISE NOTICE 'get_conflicting_overlapping_claims(%)...', claim; --get all overlapping_claims, whether they cause a conflict or not. - CREATE TEMPORARY TABLE IF NOT EXISTS overlapping_claims + CREATE TEMPORARY TABLE overlapping_claims ON COMMIT DROP AS SELECT * FROM resource_allocation.resource_claim rc WHERE rc.resource_id = claim.resource_id