On 2023-Nov-08, Peter Eisentraut wrote:

> I think the earlier idea of just counting roles, tablespaces, etc. before
> and after would be sufficient.

Maybe record global objects in a permanent table in test_setup.sql

create table global_objs as
select 'role', rolname from pg_roles
union all
select 'tablespace', spcname from pg_tablespace;

and at the end (maybe in test tablespace, though it's unrelated but it's
what runs last and drops regress_tablespace), have

(select 'role', rolname from pg_roles
union all
select 'tablespace', spcname from pg_tablespace)
except
select * from global_objs;

and check the expected as empty.

-- 
Álvaro Herrera               48°01'N 7°57'E  —  https://www.EnterpriseDB.com/
"La verdad no siempre es bonita, pero el hambre de ella sí"


Reply via email to