From dcd46923c495d0910b2a55799f02e8295b20ce2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Mar=C3=ADn?= Date: Tue, 17 Nov 2020 12:13:59 +0100 Subject: [PATCH] Adapt output to work with Travis and different PG releases --- test/CDB_RegenerateTable.sql | 41 +++++++++++---------------------- test/CDB_RegenerateTable_expect | 20 ++++++++-------- 2 files changed, 24 insertions(+), 37 deletions(-) diff --git a/test/CDB_RegenerateTable.sql b/test/CDB_RegenerateTable.sql index 49b0a52..945c64b 100644 --- a/test/CDB_RegenerateTable.sql +++ b/test/CDB_RegenerateTable.sql @@ -58,14 +58,10 @@ CREATE TRIGGER testtable_trigger_example SELECT event_object_schema as table_schema, event_object_table as table_name, trigger_schema, - trigger_name, - string_agg(event_manipulation, ',') as event, - action_timing as activation, - action_condition as condition, - action_statement as definition + trigger_name FROM information_schema.triggers WHERE event_object_table = 'testtable' -GROUP BY 1,2,3,4,6,7,8 +GROUP BY 1,2,3,4 ORDER BY table_schema, table_name; @@ -74,16 +70,13 @@ SELECT cartodb.CDB_RegenerateTable('testtable'::regclass::oid); SELECT event_object_schema as table_schema, event_object_table as table_name, trigger_schema, - trigger_name, - string_agg(event_manipulation, ',') as event, - action_timing as activation, - action_condition as condition, - action_statement as definition + trigger_name FROM information_schema.triggers WHERE event_object_table = 'testtable' -GROUP BY 1,2,3,4,6,7,8 +GROUP BY 1,2,3,4 ORDER BY table_schema, - table_name; + table_name, + trigger_name; \echo '## Check Cartodbfycation' SELECT CDB_SetUserQuotaInBytes(0); @@ -93,16 +86,13 @@ SELECT tablename, indexname, indexdef FROM pg_indexes WHERE tablename = 'testtab SELECT event_object_schema as table_schema, event_object_table as table_name, trigger_schema, - trigger_name, - string_agg(event_manipulation, ',') as event, - action_timing as activation, - action_condition as condition, - action_statement as definition + trigger_name FROM information_schema.triggers WHERE event_object_table = 'testtable' -GROUP BY 1,2,3,4,6,7,8 +GROUP BY 1,2,3,4 ORDER BY table_schema, - table_name; + table_name, + trigger_name; SELECT cartodb.CDB_RegenerateTable('testtable'::regclass::oid); @@ -111,16 +101,13 @@ SELECT tablename, indexname, indexdef FROM pg_indexes WHERE tablename = 'testtab SELECT event_object_schema as table_schema, event_object_table as table_name, trigger_schema, - trigger_name, - string_agg(event_manipulation, ',') as event, - action_timing as activation, - action_condition as condition, - action_statement as definition + trigger_name FROM information_schema.triggers WHERE event_object_table = 'testtable' -GROUP BY 1,2,3,4,6,7,8 +GROUP BY 1,2,3,4 ORDER BY table_schema, - table_name; + table_name, + trigger_name; \echo '## Test view / matview dependencies: It will not work but data will be the same' CREATE VIEW testview AS SELECT * FROM testtable WHERE stable < 20; diff --git a/test/CDB_RegenerateTable_expect b/test/CDB_RegenerateTable_expect index 7523d89..642ab14 100644 --- a/test/CDB_RegenerateTable_expect +++ b/test/CDB_RegenerateTable_expect @@ -49,9 +49,9 @@ testtable|testtable_stable_idx|CREATE INDEX testtable_stable_idx ON public.testt ## Check triggers CREATE FUNCTION CREATE TRIGGER -public|testtable|public|testtable_trigger_example|UPDATE|BEFORE||EXECUTE FUNCTION trigger_example_fn() +public|testtable|public|testtable_trigger_example -public|testtable|public|testtable_trigger_example|UPDATE|BEFORE||EXECUTE FUNCTION trigger_example_fn() +public|testtable|public|testtable_trigger_example ## Check Cartodbfycation 0 testtable @@ -66,10 +66,10 @@ c4|integer||||plain|| testtable|testtable_pkey|CREATE UNIQUE INDEX testtable_pkey ON public.testtable USING btree (cartodb_id) testtable|testtable_the_geom_idx|CREATE INDEX testtable_the_geom_idx ON public.testtable USING gist (the_geom) testtable|testtable_the_geom_webmercator_idx|CREATE INDEX testtable_the_geom_webmercator_idx ON public.testtable USING gist (the_geom_webmercator) -public|testtable|public|test_quota|INSERT,UPDATE|BEFORE||EXECUTE FUNCTION cdb_checkquota('0.1', '-1', 'public') -public|testtable|public|test_quota_per_row|INSERT,UPDATE|BEFORE||EXECUTE FUNCTION cdb_checkquota('0.001', '-1', 'public') -public|testtable|public|track_updates|INSERT,DELETE,UPDATE|AFTER||EXECUTE FUNCTION cdb_tablemetadata_trigger() -public|testtable|public|update_the_geom_webmercator_trigger|UPDATE,INSERT|BEFORE||EXECUTE FUNCTION _cdb_update_the_geom_webmercator() +public|testtable|public|test_quota +public|testtable|public|test_quota_per_row +public|testtable|public|track_updates +public|testtable|public|update_the_geom_webmercator_trigger cartodb_id|bigint||not null|nextval('testtable_cartodb_id_seq'::regclass)|plain|| the_geom|geometry(Geometry,4326)||||main|| @@ -82,10 +82,10 @@ c4|integer||||plain|| testtable|testtable_pkey|CREATE UNIQUE INDEX testtable_pkey ON public.testtable USING btree (cartodb_id) testtable|testtable_the_geom_idx|CREATE INDEX testtable_the_geom_idx ON public.testtable USING gist (the_geom) testtable|testtable_the_geom_webmercator_idx|CREATE INDEX testtable_the_geom_webmercator_idx ON public.testtable USING gist (the_geom_webmercator) -public|testtable|public|test_quota|INSERT,UPDATE|BEFORE||EXECUTE FUNCTION cdb_checkquota('0.1', '-1', 'public') -public|testtable|public|test_quota_per_row|INSERT,UPDATE|BEFORE||EXECUTE FUNCTION cdb_checkquota('0.001', '-1', 'public') -public|testtable|public|track_updates|INSERT,DELETE,UPDATE|AFTER||EXECUTE FUNCTION cdb_tablemetadata_trigger() -public|testtable|public|update_the_geom_webmercator_trigger|INSERT,UPDATE|BEFORE||EXECUTE FUNCTION _cdb_update_the_geom_webmercator() +public|testtable|public|test_quota +public|testtable|public|test_quota_per_row +public|testtable|public|track_updates +public|testtable|public|update_the_geom_webmercator_trigger ## Test view / matview dependencies: It will not work but data will be the same CREATE VIEW 1|||1|2|3|4|5