Skip to content

Commit 0086948

Browse files
committed
db:Fix bug in calculating statistical_unit.last_edit_by from statistical variables
1 parent 34b33cc commit 0086948

File tree

39 files changed

+1505
-53
lines changed

39 files changed

+1505
-53
lines changed

migrations/20240305000000_create_timeline_establishment.up.sql

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,15 @@ CREATE OR REPLACE VIEW public.timeline_establishment_def
267267
FROM public.stat_for_unit AS sfu
268268
WHERE sfu.establishment_id = es.id
269269
AND from_until_overlaps(t.valid_from, t.valid_until, sfu.valid_from, sfu.valid_until)
270-
) AS sfu ON TRUE
270+
) AS sfu_ds ON TRUE
271+
LEFT JOIN LATERAL (
272+
SELECT sfu.edit_comment, sfu.edit_by_user_id, sfu.edit_at
273+
FROM public.stat_for_unit AS sfu
274+
WHERE sfu.establishment_id = es.id
275+
AND from_until_overlaps(t.valid_from, t.valid_until, sfu.valid_from, sfu.valid_until)
276+
ORDER BY sfu.edit_at DESC
277+
LIMIT 1
278+
) AS sfu_le ON TRUE
271279
LEFT JOIN LATERAL (
272280
SELECT array_agg(ds.id) AS ids
273281
, array_agg(ds.code) AS codes
@@ -277,7 +285,7 @@ CREATE OR REPLACE VIEW public.timeline_establishment_def
277285
OR COALESCE(ds.id = sa.data_source_id , FALSE)
278286
OR COALESCE(ds.id = phl.data_source_id , FALSE)
279287
OR COALESCE(ds.id = pol.data_source_id , FALSE)
280-
OR COALESCE(ds.id = ANY(sfu.data_source_ids), FALSE)
288+
OR COALESCE(ds.id = ANY(sfu_ds.data_source_ids), FALSE)
281289
) AS ds ON TRUE
282290
LEFT JOIN LATERAL (
283291
SELECT edit_comment, edit_by_user_id, edit_at
@@ -288,7 +296,8 @@ CREATE OR REPLACE VIEW public.timeline_establishment_def
288296
(sa.edit_comment, sa.edit_by_user_id, sa.edit_at),
289297
(phl.edit_comment, phl.edit_by_user_id, phl.edit_at),
290298
(pol.edit_comment, pol.edit_by_user_id, pol.edit_at),
291-
(c.edit_comment, c.edit_by_user_id, c.edit_at)
299+
(c.edit_comment, c.edit_by_user_id, c.edit_at),
300+
(sfu_le.edit_comment, sfu_le.edit_by_user_id, sfu_le.edit_at)
292301
) AS all_edits(edit_comment, edit_by_user_id, edit_at)
293302
WHERE edit_at IS NOT NULL
294303
ORDER BY edit_at DESC

migrations/20240306000000_create_timeline_legal_unit.up.sql

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,15 @@ CREATE OR REPLACE VIEW public.timeline_legal_unit_def
255255
FROM public.stat_for_unit AS sfu
256256
WHERE sfu.legal_unit_id = lu.id
257257
AND from_until_overlaps(t.valid_from, t.valid_until, sfu.valid_from, sfu.valid_until)
258-
) AS sfu ON TRUE
258+
) AS sfu_ds ON TRUE
259+
LEFT JOIN LATERAL (
260+
SELECT sfu.edit_comment, sfu.edit_by_user_id, sfu.edit_at
261+
FROM public.stat_for_unit AS sfu
262+
WHERE sfu.legal_unit_id = lu.id
263+
AND from_until_overlaps(t.valid_from, t.valid_until, sfu.valid_from, sfu.valid_until)
264+
ORDER BY sfu.edit_at DESC
265+
LIMIT 1
266+
) AS sfu_le ON TRUE
259267
LEFT JOIN LATERAL (
260268
SELECT array_agg(ds.id) AS ids
261269
, array_agg(ds.code) AS codes
@@ -265,7 +273,7 @@ CREATE OR REPLACE VIEW public.timeline_legal_unit_def
265273
OR COALESCE(ds.id = sa.data_source_id , FALSE)
266274
OR COALESCE(ds.id = phl.data_source_id , FALSE)
267275
OR COALESCE(ds.id = pol.data_source_id , FALSE)
268-
OR COALESCE(ds.id = ANY(sfu.data_source_ids), FALSE)
276+
OR COALESCE(ds.id = ANY(sfu_ds.data_source_ids), FALSE)
269277
) AS ds ON TRUE
270278
LEFT JOIN LATERAL (
271279
SELECT edit_comment, edit_by_user_id, edit_at
@@ -276,7 +284,8 @@ CREATE OR REPLACE VIEW public.timeline_legal_unit_def
276284
(sa.edit_comment, sa.edit_by_user_id, sa.edit_at),
277285
(phl.edit_comment, phl.edit_by_user_id, phl.edit_at),
278286
(pol.edit_comment, pol.edit_by_user_id, pol.edit_at),
279-
(c.edit_comment, c.edit_by_user_id, c.edit_at)
287+
(c.edit_comment, c.edit_by_user_id, c.edit_at),
288+
(sfu_le.edit_comment, sfu_le.edit_by_user_id, sfu_le.edit_at)
280289
) AS all_edits(edit_comment, edit_by_user_id, edit_at)
281290
WHERE edit_at IS NOT NULL
282291
ORDER BY edit_at DESC

test/expected/005_load_users_and_modify_role.out

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,44 @@ SELECT * FROM public.user_create(p_display_name => 'Test Restricted', p_email =>
5858
test.restricted@statbus.org | Restricted#123!
5959
(1 row)
6060

61+
CREATE OR REPLACE PROCEDURE test.remove_pg_temp_for_tx_user_switch(p_keep_tables text[] DEFAULT '{}')
62+
LANGUAGE plpgsql
63+
AS $remove_pg_temp_for_tx_user_switch$
64+
DECLARE
65+
rec record;
66+
v_found_count integer := 0;
67+
BEGIN
68+
RAISE DEBUG 'Running test.remove_pg_temp_for_tx_user_switch(p_keep_tables => %)...', p_keep_tables;
69+
-- Remove temporary cache tables used by import, as we switch user inside the *same* transaction,
70+
-- and the new user can not modify tables owned by the previous import.
71+
-- This generic loop cleans up all tables and views in the pg_temp schema, except those specified to keep.
72+
FOR rec IN
73+
SELECT
74+
c.relname,
75+
c.relkind
76+
FROM pg_catalog.pg_class AS c
77+
LEFT JOIN pg_catalog.pg_namespace AS n ON n.oid = c.relnamespace
78+
WHERE c.relkind IN ('r', 'p', 'v', 'm') AND n.oid = pg_my_temp_schema() -- r=table, p=partitioned, v=view, m=materialized
79+
AND c.relname <> ALL(p_keep_tables)
80+
LOOP
81+
v_found_count := v_found_count + 1;
82+
IF rec.relkind IN ('r', 'p', 'm') THEN
83+
RAISE DEBUG ' -> Dropping temp TABLE %', rec.relname;
84+
EXECUTE format('DROP TABLE IF EXISTS pg_temp.%I CASCADE', rec.relname);
85+
ELSIF rec.relkind = 'v' THEN
86+
RAISE DEBUG ' -> Dropping temp VIEW %', rec.relname;
87+
EXECUTE format('DROP VIEW IF EXISTS pg_temp.%I CASCADE', rec.relname);
88+
END IF;
89+
END LOOP;
90+
91+
RAISE DEBUG '...finished test.remove_pg_temp_for_tx_user_switch(). Found and dropped % objects.', v_found_count;
92+
93+
-- This procedure is part of the sql_saga extension and has its own cleanup logic.
94+
-- While the loop above handles tables/views, this call ensures any other temporary
95+
-- objects it creates are also cleaned up.
96+
CALL sql_saga.temporal_merge_drop_temp_tables();
97+
END;
98+
$remove_pg_temp_for_tx_user_switch$;
6199
-- Create test users with different roles
62100
SELECT public.user_create(p_display_name => 'Example Admin', p_email => 'test.admin@example.com', p_statbus_role => 'admin_user'::statbus_role, p_password => 'AdminPass123!');
63101
user_create

test/expected/007_test_sql_saga_synchronize_valid_to.out

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,44 @@ SELECT * FROM public.user_create(p_display_name => 'Test Restricted', p_email =>
5858
test.restricted@statbus.org | Restricted#123!
5959
(1 row)
6060

61+
CREATE OR REPLACE PROCEDURE test.remove_pg_temp_for_tx_user_switch(p_keep_tables text[] DEFAULT '{}')
62+
LANGUAGE plpgsql
63+
AS $remove_pg_temp_for_tx_user_switch$
64+
DECLARE
65+
rec record;
66+
v_found_count integer := 0;
67+
BEGIN
68+
RAISE DEBUG 'Running test.remove_pg_temp_for_tx_user_switch(p_keep_tables => %)...', p_keep_tables;
69+
-- Remove temporary cache tables used by import, as we switch user inside the *same* transaction,
70+
-- and the new user can not modify tables owned by the previous import.
71+
-- This generic loop cleans up all tables and views in the pg_temp schema, except those specified to keep.
72+
FOR rec IN
73+
SELECT
74+
c.relname,
75+
c.relkind
76+
FROM pg_catalog.pg_class AS c
77+
LEFT JOIN pg_catalog.pg_namespace AS n ON n.oid = c.relnamespace
78+
WHERE c.relkind IN ('r', 'p', 'v', 'm') AND n.oid = pg_my_temp_schema() -- r=table, p=partitioned, v=view, m=materialized
79+
AND c.relname <> ALL(p_keep_tables)
80+
LOOP
81+
v_found_count := v_found_count + 1;
82+
IF rec.relkind IN ('r', 'p', 'm') THEN
83+
RAISE DEBUG ' -> Dropping temp TABLE %', rec.relname;
84+
EXECUTE format('DROP TABLE IF EXISTS pg_temp.%I CASCADE', rec.relname);
85+
ELSIF rec.relkind = 'v' THEN
86+
RAISE DEBUG ' -> Dropping temp VIEW %', rec.relname;
87+
EXECUTE format('DROP VIEW IF EXISTS pg_temp.%I CASCADE', rec.relname);
88+
END IF;
89+
END LOOP;
90+
91+
RAISE DEBUG '...finished test.remove_pg_temp_for_tx_user_switch(). Found and dropped % objects.', v_found_count;
92+
93+
-- This procedure is part of the sql_saga extension and has its own cleanup logic.
94+
-- While the loop above handles tables/views, this call ensures any other temporary
95+
-- objects it creates are also cleaned up.
96+
CALL sql_saga.temporal_merge_drop_temp_tables();
97+
END;
98+
$remove_pg_temp_for_tx_user_switch$;
6199
\echo '----------------------------------------------------------------------------'
62100
----------------------------------------------------------------------------
63101
\echo 'Test: sql_saga trigger behavior for synchronized valid_to/valid_until'

test/expected/012_test_default_import_definitions.out

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,44 @@ SELECT * FROM public.user_create(p_display_name => 'Test Restricted', p_email =>
5858
test.restricted@statbus.org | Restricted#123!
5959
(1 row)
6060

61+
CREATE OR REPLACE PROCEDURE test.remove_pg_temp_for_tx_user_switch(p_keep_tables text[] DEFAULT '{}')
62+
LANGUAGE plpgsql
63+
AS $remove_pg_temp_for_tx_user_switch$
64+
DECLARE
65+
rec record;
66+
v_found_count integer := 0;
67+
BEGIN
68+
RAISE DEBUG 'Running test.remove_pg_temp_for_tx_user_switch(p_keep_tables => %)...', p_keep_tables;
69+
-- Remove temporary cache tables used by import, as we switch user inside the *same* transaction,
70+
-- and the new user can not modify tables owned by the previous import.
71+
-- This generic loop cleans up all tables and views in the pg_temp schema, except those specified to keep.
72+
FOR rec IN
73+
SELECT
74+
c.relname,
75+
c.relkind
76+
FROM pg_catalog.pg_class AS c
77+
LEFT JOIN pg_catalog.pg_namespace AS n ON n.oid = c.relnamespace
78+
WHERE c.relkind IN ('r', 'p', 'v', 'm') AND n.oid = pg_my_temp_schema() -- r=table, p=partitioned, v=view, m=materialized
79+
AND c.relname <> ALL(p_keep_tables)
80+
LOOP
81+
v_found_count := v_found_count + 1;
82+
IF rec.relkind IN ('r', 'p', 'm') THEN
83+
RAISE DEBUG ' -> Dropping temp TABLE %', rec.relname;
84+
EXECUTE format('DROP TABLE IF EXISTS pg_temp.%I CASCADE', rec.relname);
85+
ELSIF rec.relkind = 'v' THEN
86+
RAISE DEBUG ' -> Dropping temp VIEW %', rec.relname;
87+
EXECUTE format('DROP VIEW IF EXISTS pg_temp.%I CASCADE', rec.relname);
88+
END IF;
89+
END LOOP;
90+
91+
RAISE DEBUG '...finished test.remove_pg_temp_for_tx_user_switch(). Found and dropped % objects.', v_found_count;
92+
93+
-- This procedure is part of the sql_saga extension and has its own cleanup logic.
94+
-- While the loop above handles tables/views, this call ensures any other temporary
95+
-- objects it creates are also cleaned up.
96+
CALL sql_saga.temporal_merge_drop_temp_tables();
97+
END;
98+
$remove_pg_temp_for_tx_user_switch$;
6199
-- No specific user context is strictly needed for querying definition tables,
62100
-- but setting it to admin for consistency with other tests.
63101
CALL test.set_user_from_email('test.admin@statbus.org');

test/expected/013_auth.out

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,44 @@ SELECT * FROM public.user_create(p_display_name => 'Test Restricted', p_email =>
6565
test.restricted@statbus.org | Restricted#123!
6666
(1 row)
6767

68+
CREATE OR REPLACE PROCEDURE test.remove_pg_temp_for_tx_user_switch(p_keep_tables text[] DEFAULT '{}')
69+
LANGUAGE plpgsql
70+
AS $remove_pg_temp_for_tx_user_switch$
71+
DECLARE
72+
rec record;
73+
v_found_count integer := 0;
74+
BEGIN
75+
RAISE DEBUG 'Running test.remove_pg_temp_for_tx_user_switch(p_keep_tables => %)...', p_keep_tables;
76+
-- Remove temporary cache tables used by import, as we switch user inside the *same* transaction,
77+
-- and the new user can not modify tables owned by the previous import.
78+
-- This generic loop cleans up all tables and views in the pg_temp schema, except those specified to keep.
79+
FOR rec IN
80+
SELECT
81+
c.relname,
82+
c.relkind
83+
FROM pg_catalog.pg_class AS c
84+
LEFT JOIN pg_catalog.pg_namespace AS n ON n.oid = c.relnamespace
85+
WHERE c.relkind IN ('r', 'p', 'v', 'm') AND n.oid = pg_my_temp_schema() -- r=table, p=partitioned, v=view, m=materialized
86+
AND c.relname <> ALL(p_keep_tables)
87+
LOOP
88+
v_found_count := v_found_count + 1;
89+
IF rec.relkind IN ('r', 'p', 'm') THEN
90+
RAISE DEBUG ' -> Dropping temp TABLE %', rec.relname;
91+
EXECUTE format('DROP TABLE IF EXISTS pg_temp.%I CASCADE', rec.relname);
92+
ELSIF rec.relkind = 'v' THEN
93+
RAISE DEBUG ' -> Dropping temp VIEW %', rec.relname;
94+
EXECUTE format('DROP VIEW IF EXISTS pg_temp.%I CASCADE', rec.relname);
95+
END IF;
96+
END LOOP;
97+
98+
RAISE DEBUG '...finished test.remove_pg_temp_for_tx_user_switch(). Found and dropped % objects.', v_found_count;
99+
100+
-- This procedure is part of the sql_saga extension and has its own cleanup logic.
101+
-- While the loop above handles tables/views, this call ensures any other temporary
102+
-- objects it creates are also cleaned up.
103+
CALL sql_saga.temporal_merge_drop_temp_tables();
104+
END;
105+
$remove_pg_temp_for_tx_user_switch$;
68106
-- Create a test-specific schema for helper functions
69107
CREATE SCHEMA IF NOT EXISTS auth_test;
70108
-- Helper function to reset common request GUCs for tests

test/expected/100_regions_with__itudes.out

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,44 @@ SELECT * FROM public.user_create(p_display_name => 'Test Restricted', p_email =>
5858
test.restricted@statbus.org | Restricted#123!
5959
(1 row)
6060

61+
CREATE OR REPLACE PROCEDURE test.remove_pg_temp_for_tx_user_switch(p_keep_tables text[] DEFAULT '{}')
62+
LANGUAGE plpgsql
63+
AS $remove_pg_temp_for_tx_user_switch$
64+
DECLARE
65+
rec record;
66+
v_found_count integer := 0;
67+
BEGIN
68+
RAISE DEBUG 'Running test.remove_pg_temp_for_tx_user_switch(p_keep_tables => %)...', p_keep_tables;
69+
-- Remove temporary cache tables used by import, as we switch user inside the *same* transaction,
70+
-- and the new user can not modify tables owned by the previous import.
71+
-- This generic loop cleans up all tables and views in the pg_temp schema, except those specified to keep.
72+
FOR rec IN
73+
SELECT
74+
c.relname,
75+
c.relkind
76+
FROM pg_catalog.pg_class AS c
77+
LEFT JOIN pg_catalog.pg_namespace AS n ON n.oid = c.relnamespace
78+
WHERE c.relkind IN ('r', 'p', 'v', 'm') AND n.oid = pg_my_temp_schema() -- r=table, p=partitioned, v=view, m=materialized
79+
AND c.relname <> ALL(p_keep_tables)
80+
LOOP
81+
v_found_count := v_found_count + 1;
82+
IF rec.relkind IN ('r', 'p', 'm') THEN
83+
RAISE DEBUG ' -> Dropping temp TABLE %', rec.relname;
84+
EXECUTE format('DROP TABLE IF EXISTS pg_temp.%I CASCADE', rec.relname);
85+
ELSIF rec.relkind = 'v' THEN
86+
RAISE DEBUG ' -> Dropping temp VIEW %', rec.relname;
87+
EXECUTE format('DROP VIEW IF EXISTS pg_temp.%I CASCADE', rec.relname);
88+
END IF;
89+
END LOOP;
90+
91+
RAISE DEBUG '...finished test.remove_pg_temp_for_tx_user_switch(). Found and dropped % objects.', v_found_count;
92+
93+
-- This procedure is part of the sql_saga extension and has its own cleanup logic.
94+
-- While the loop above handles tables/views, this call ensures any other temporary
95+
-- objects it creates are also cleaned up.
96+
CALL sql_saga.temporal_merge_drop_temp_tables();
97+
END;
98+
$remove_pg_temp_for_tx_user_switch$;
6199
\echo "Testing regions with coordinates"
62100
"Testing regions with coordinates"
63101
-- Test invalid latitude (>90)

test/expected/102_verify_data_tables_for_default_import_jobs.out

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,44 @@ SELECT * FROM public.user_create(p_display_name => 'Test Restricted', p_email =>
5858
test.restricted@statbus.org | Restricted#123!
5959
(1 row)
6060

61+
CREATE OR REPLACE PROCEDURE test.remove_pg_temp_for_tx_user_switch(p_keep_tables text[] DEFAULT '{}')
62+
LANGUAGE plpgsql
63+
AS $remove_pg_temp_for_tx_user_switch$
64+
DECLARE
65+
rec record;
66+
v_found_count integer := 0;
67+
BEGIN
68+
RAISE DEBUG 'Running test.remove_pg_temp_for_tx_user_switch(p_keep_tables => %)...', p_keep_tables;
69+
-- Remove temporary cache tables used by import, as we switch user inside the *same* transaction,
70+
-- and the new user can not modify tables owned by the previous import.
71+
-- This generic loop cleans up all tables and views in the pg_temp schema, except those specified to keep.
72+
FOR rec IN
73+
SELECT
74+
c.relname,
75+
c.relkind
76+
FROM pg_catalog.pg_class AS c
77+
LEFT JOIN pg_catalog.pg_namespace AS n ON n.oid = c.relnamespace
78+
WHERE c.relkind IN ('r', 'p', 'v', 'm') AND n.oid = pg_my_temp_schema() -- r=table, p=partitioned, v=view, m=materialized
79+
AND c.relname <> ALL(p_keep_tables)
80+
LOOP
81+
v_found_count := v_found_count + 1;
82+
IF rec.relkind IN ('r', 'p', 'm') THEN
83+
RAISE DEBUG ' -> Dropping temp TABLE %', rec.relname;
84+
EXECUTE format('DROP TABLE IF EXISTS pg_temp.%I CASCADE', rec.relname);
85+
ELSIF rec.relkind = 'v' THEN
86+
RAISE DEBUG ' -> Dropping temp VIEW %', rec.relname;
87+
EXECUTE format('DROP VIEW IF EXISTS pg_temp.%I CASCADE', rec.relname);
88+
END IF;
89+
END LOOP;
90+
91+
RAISE DEBUG '...finished test.remove_pg_temp_for_tx_user_switch(). Found and dropped % objects.', v_found_count;
92+
93+
-- This procedure is part of the sql_saga extension and has its own cleanup logic.
94+
-- While the loop above handles tables/views, this call ensures any other temporary
95+
-- objects it creates are also cleaned up.
96+
CALL sql_saga.temporal_merge_drop_temp_tables();
97+
END;
98+
$remove_pg_temp_for_tx_user_switch$;
6199
CALL test.set_user_from_email('test.admin@statbus.org');
62100
\echo "Test: Verify structure of _data tables for default import definitions"
63101
"Test: Verify structure of _data tables for default import definitions"

test/expected/103_legal_units_with_data_source.out

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,44 @@ SELECT * FROM public.user_create(p_display_name => 'Test Restricted', p_email =>
5858
test.restricted@statbus.org | Restricted#123!
5959
(1 row)
6060

61+
CREATE OR REPLACE PROCEDURE test.remove_pg_temp_for_tx_user_switch(p_keep_tables text[] DEFAULT '{}')
62+
LANGUAGE plpgsql
63+
AS $remove_pg_temp_for_tx_user_switch$
64+
DECLARE
65+
rec record;
66+
v_found_count integer := 0;
67+
BEGIN
68+
RAISE DEBUG 'Running test.remove_pg_temp_for_tx_user_switch(p_keep_tables => %)...', p_keep_tables;
69+
-- Remove temporary cache tables used by import, as we switch user inside the *same* transaction,
70+
-- and the new user can not modify tables owned by the previous import.
71+
-- This generic loop cleans up all tables and views in the pg_temp schema, except those specified to keep.
72+
FOR rec IN
73+
SELECT
74+
c.relname,
75+
c.relkind
76+
FROM pg_catalog.pg_class AS c
77+
LEFT JOIN pg_catalog.pg_namespace AS n ON n.oid = c.relnamespace
78+
WHERE c.relkind IN ('r', 'p', 'v', 'm') AND n.oid = pg_my_temp_schema() -- r=table, p=partitioned, v=view, m=materialized
79+
AND c.relname <> ALL(p_keep_tables)
80+
LOOP
81+
v_found_count := v_found_count + 1;
82+
IF rec.relkind IN ('r', 'p', 'm') THEN
83+
RAISE DEBUG ' -> Dropping temp TABLE %', rec.relname;
84+
EXECUTE format('DROP TABLE IF EXISTS pg_temp.%I CASCADE', rec.relname);
85+
ELSIF rec.relkind = 'v' THEN
86+
RAISE DEBUG ' -> Dropping temp VIEW %', rec.relname;
87+
EXECUTE format('DROP VIEW IF EXISTS pg_temp.%I CASCADE', rec.relname);
88+
END IF;
89+
END LOOP;
90+
91+
RAISE DEBUG '...finished test.remove_pg_temp_for_tx_user_switch(). Found and dropped % objects.', v_found_count;
92+
93+
-- This procedure is part of the sql_saga extension and has its own cleanup logic.
94+
-- While the loop above handles tables/views, this call ensures any other temporary
95+
-- objects it creates are also cleaned up.
96+
CALL sql_saga.temporal_merge_drop_temp_tables();
97+
END;
98+
$remove_pg_temp_for_tx_user_switch$;
6199
\echo "Setting up Statbus using the web provided examples"
62100
"Setting up Statbus using the web provided examples"
63101
-- A Super User configures statbus.

0 commit comments

Comments
 (0)