diff --git a/src/test/modules/test_extensions/sql/test_extensions.sql b/src/test/modules/test_extensions/sql/test_extensions.sql index 642c82ff5d..ea47f607ca 100644 --- a/src/test/modules/test_extensions/sql/test_extensions.sql +++ b/src/test/modules/test_extensions/sql/test_extensions.sql @@ -1,3 +1,18 @@ +CREATE OR REPLACE FUNCTION dx_plus(schema_name char varying) RETURNS TABLE("Object description" char varying) AS +$BODY$ +BEGIN + RETURN QUERY SELECT obj_descr::varchar AS "Object description" FROM (SELECT regexp_replace(pg_describe_object(classid, objid, objsubid) + , 'pg_temp_\d+' + , 'pg_temp', 'g') AS obj_descr + FROM pg_depend + WHERE refclassid = 'pg_extension'::regclass + AND deptype = 'e' + AND refobjid = (SELECT oid FROM pg_extension WHERE extname = schema_name)) + ORDER BY length(obj_descr), obj_descr; +END +$BODY$ +LANGUAGE plpgsql; + CREATE SCHEMA has$dollar; -- test some errors @@ -24,9 +39,9 @@ CREATE EXTENSION test_ext6; -- this table will be absorbed into test_ext7 create table old_table1 (col1 serial primary key); create extension test_ext7; -\dx+ test_ext7 +SELECT * FROM dx_plus('test_ext7'); alter extension test_ext7 update to '2.0'; -\dx+ test_ext7 +SELECT * FROM dx_plus('test_ext7'); -- test handling of temp objects created by extensions create extension test_ext8; @@ -62,22 +77,23 @@ begin end'; -- extension should now contain no temp objects -\dx+ test_ext8 +SELECT * FROM dx_plus('test_ext8'); -- dropping it should still work drop extension test_ext8; + -- check handling of types as extension members create extension test_ext9; -\dx+ test_ext9 +SELECT * FROM dx_plus('test_ext9'); alter extension test_ext9 drop type varbitrange; -\dx+ test_ext9 +SELECT * FROM dx_plus('test_ext9'); alter extension test_ext9 add type varbitrange; -\dx+ test_ext9 +SELECT * FROM dx_plus('test_ext9'); alter extension test_ext9 drop table sometable; -\dx+ test_ext9 +SELECT * FROM dx_plus('test_ext9'); alter extension test_ext9 add table sometable; -\dx+ test_ext9 +SELECT * FROM dx_plus('test_ext9'); drop extension test_ext9; -- Test creation of extension in temporary schema with two-phase commit, @@ -165,7 +181,7 @@ SELECT 'x'::test_ext_type; SELECT point(0,0) <<@@ polygon(circle(point(0,0),1)); -\dx+ test_ext_cor +SELECT * FROM dx_plus('test_ext_cor'); -- -- CREATE IF NOT EXISTS is an entirely unsound thing for an extension @@ -219,11 +235,11 @@ DROP TABLE ext_cine_tab2; CREATE EXTENSION test_ext_cine; -\dx+ test_ext_cine +SELECT * FROM dx_plus('test_ext_cine'); ALTER EXTENSION test_ext_cine UPDATE TO '1.1'; -\dx+ test_ext_cine +SELECT * FROM dx_plus('test_ext_cine'); -- -- Test @extschema@ syntax. @@ -239,7 +255,7 @@ CREATE SCHEMA s1; CREATE SCHEMA s2; CREATE EXTENSION test_ext_set_schema SCHEMA s1; ALTER EXTENSION test_ext_set_schema SET SCHEMA s2; -\dx+ test_ext_set_schema +SELECT * FROM dx_plus('test_ext_set_schema'); \sf s2.ess_func(int) --