Skip to content
Snippets Groups Projects
Commit 7de1ce6f authored by Jan David Mol's avatar Jan David Mol
Browse files

Task #10811: Cannot use "IF NOT EXISTS" in "CREATE TABLE AS" in postgres <9.4

parent 54799d89
No related branches found
No related tags found
No related merge requests found
...@@ -28,8 +28,12 @@ To create a fresh and empty RADB, follow the following steps. ...@@ -28,8 +28,12 @@ To create a fresh and empty RADB, follow the following steps.
ssh scu199 ssh scu199
* Obtain/adjust the relevant credentials. As lofarsys: * Obtain/adjust the relevant credentials. As lofarsys:
cat ~/.lofar/dbcredentials/radb.ini 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): * If you want a NEW database, create one (see radb.ini for the relevant parameters):
(see create_database.sql) (see create_database.sql)
* Reinitialise the database (see radb.ini for the relevant parameters): * Reinitialise the database (see radb.ini for the relevant parameters):
psql -h $DBHOST $DATABASE -U $DBUSER -f create_and_populate_database.sql -W psql -h $DBHOST $DATABASE -U $DBUSER -f create_and_populate_database.sql -W
* Ignore all NOTICES. * Ignore all NOTICES.
* Stop any services interacting with the radb:
supervisorctl -p 123 start RA_Services:
...@@ -561,7 +561,7 @@ BEGIN ...@@ -561,7 +561,7 @@ BEGIN
-- for performance reasons we repeat the common code here instead of wrapping the common code in a function -- 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. --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 ON COMMIT DROP
AS SELECT * FROM resource_allocation.resource_claim rc AS SELECT * FROM resource_allocation.resource_claim rc
WHERE rc.resource_id = claim.resource_id WHERE rc.resource_id = claim.resource_id
...@@ -626,7 +626,7 @@ BEGIN ...@@ -626,7 +626,7 @@ BEGIN
--RAISE NOTICE 'get_conflicting_overlapping_claims(%)...', claim; --RAISE NOTICE 'get_conflicting_overlapping_claims(%)...', claim;
--get all overlapping_claims, whether they cause a conflict or not. --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 ON COMMIT DROP
AS SELECT * FROM resource_allocation.resource_claim rc AS SELECT * FROM resource_allocation.resource_claim rc
WHERE rc.resource_id = claim.resource_id WHERE rc.resource_id = claim.resource_id
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment