diff --git a/docker/multistage/TEST_config_live.xml b/docker/multistage/TEST_config_live.xml
index 2c70ff7..0d6fbc5 100644
--- a/docker/multistage/TEST_config_live.xml
+++ b/docker/multistage/TEST_config_live.xml
@@ -5,13 +5,13 @@
1000
500
- jdbc:postgresql://localhost:5432/test
+ jdbc:postgresql://testdb:5432/test
test
test
600000
- jdbc:postgresql://localhost:5432/test
+ jdbc:postgresql://testdb:5432/test
test
test
@@ -49,10 +49,43 @@
OR dest.test_ts = EXCLUDED.test_ts
+
+ test upsert
+ select -1 as key
+
+
+ insert into public.dest(
+ id,
+ test_int,
+ test_text,
+ test_ts
+ )values(
+ ?::bigint,
+ ?::integer,
+ ?::text,
+ ?::timestamp with time zone
+ )ON CONFLICT(id) DO UPDATE
+ set
+ test_int = EXCLUDED.test_int,
+ test_text = EXCLUDED.test_text,
+ test_ts = EXCLUDED.test_ts
+ WHERE
+ dest.test_int IS DISTINCT FROM EXCLUDED.test_int
+ OR dest.test_text IS DISTINCT FROM EXCLUDED.test_text
+ OR dest.test_ts IS DISTINCT FROM EXCLUDED.test_ts
+
+
denormalise
select -1 as key
-
+
INSERT INTO denormalised_personalia(person_id,fname,lname)
values(?::integer,?::text,?::text)
diff --git a/docker/multistage/wait_for_postgres b/docker/multistage/wait_for_postgres
index d3dee95..9676149 100755
--- a/docker/multistage/wait_for_postgres
+++ b/docker/multistage/wait_for_postgres
@@ -8,5 +8,14 @@ until PGPASSWORD=test psql -h "testdb" -U "test" -c 'SELECT 1 FROM public.contai
sleep 1
done
+>&2 echo "Postgres is up - Waiting for the reboot"
+sleep 3 # Wait for the Postgres reboot at the end of setup
+
+until PGPASSWORD=test psql -h "testdb" -U "test" -c 'SELECT 1 FROM public.container_ready' postgres; do
+ >&2 echo "Postgres is unavailable - sleeping"
+ sleep 1
+done
+
+
>&2 echo "Postgres is up - executing command"
exec $cmd
diff --git a/docker/test_db/setup.sql b/docker/test_db/setup.sql
index 782f213..ff4a1b7 100644
--- a/docker/test_db/setup.sql
+++ b/docker/test_db/setup.sql
@@ -44,6 +44,9 @@ CREATE TABLE denormalised_personalia(
lname text
);
+GRANT SELECT ON ALL TABLES IN SCHEMA public TO test;
+GRANT SELECT,INSERT,UPDATE ON denormalised_personalia TO test;
+
\c postgres
CREATE TABLE public.container_ready AS SELECT 1 FROM(VALUES(1)) AS a(a);
diff --git a/src/test/resources/TEST_config_live.xml b/src/test/resources/TEST_config_live.xml
index 2c70ff7..b4630a3 100644
--- a/src/test/resources/TEST_config_live.xml
+++ b/src/test/resources/TEST_config_live.xml
@@ -49,6 +49,39 @@
OR dest.test_ts = EXCLUDED.test_ts
+
+ test upsert
+ select -1 as key
+
+
+ insert into public.dest(
+ id,
+ test_int,
+ test_text,
+ test_ts
+ )values(
+ ?::bigint,
+ ?::integer,
+ ?::text,
+ ?::timestamp with time zone
+ )ON CONFLICT(id) DO UPDATE
+ set
+ test_int = EXCLUDED.test_int,
+ test_text = EXCLUDED.test_text,
+ test_ts = EXCLUDED.test_ts
+ WHERE
+ dest.test_int IS DISTINCT FROM EXCLUDED.test_int
+ OR dest.test_text IS DISTINCT FROM EXCLUDED.test_text
+ OR dest.test_ts IS DISTINCT FROM EXCLUDED.test_ts
+
+
denormalise
select -1 as key