/* * Test the "main" verse.create_resource_providers( ) function */ BEGIN; /* Create a dummy rp_stats table that contains a few identifiers */ CREATE TEMP TABLE rp_stats OF verse.resprov_generator_type ON COMMIT DROP; INSERT INTO rp_stats ( resource_name_id ) VALUES ( 1 ) , ( 2 ) , ( 3 ) , ( 4 ); /* Replace the verse.create_resource_providers( area , type ) function * with a function that deletes the resource type it was given from * rp_stats. */ CREATE OR REPLACE FUNCTION verse.create_resource_providers( _area verse.generator_area_type , _data verse.resprov_generator_type ) RETURNS VOID STRICT VOLATILE SECURITY INVOKER AS $create_resource_providers$ BEGIN DELETE FROM rp_stats WHERE resource_name_id = _data.resource_name_id; END; $create_resource_providers$ LANGUAGE PLPGSQL; SELECT plan(1); SELECT diag_test_name( 'verse.create_resource_providers( area ) - Calls to per-type function' ); SELECT verse.create_resource_providers( ROW( 0 , 0 , 1 , 1 ) ); SELECT is( COUNT(*)::INT , 0 ) FROM rp_stats; SELECT * FROM finish( ); ROLLBACK;