From 3157cbe974846729d49a1ee081944eee1839bdd8 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 15 Apr 2021 16:31:36 -0400 Subject: [PATCH] Stabilize recently-added information_schema test queries. These queries could show unexpected entries if the core system, or concurrently-running test scripts, created any functions that would appear in the information_schema views. Restrict them to showing functions belonging to this test's schema, as the far-older nearby test case does. Per experimentation with conversion of some built-in functions to SQL-function-body style. --- src/test/regress/expected/create_function_3.out | 14 +++++++++++--- src/test/regress/sql/create_function_3.sql | 14 +++++++++++--- 2 files changed, 22 insertions(+), 6 deletions(-) diff --git a/src/test/regress/expected/create_function_3.out b/src/test/regress/expected/create_function_3.out index 477130e620e..94ff7095e7d 100644 --- a/src/test/regress/expected/create_function_3.out +++ b/src/test/regress/expected/create_function_3.out @@ -475,26 +475,34 @@ SELECT r0.routine_name, r1.routine_name FROM information_schema.routine_routine_usage rru JOIN information_schema.routines r0 ON r0.specific_name = rru.specific_name JOIN information_schema.routines r1 ON r1.specific_name = rru.routine_name + WHERE r0.routine_schema = 'temp_func_test' AND + r1.routine_schema = 'temp_func_test' ORDER BY 1, 2; routine_name | routine_name ----------------+---------------- functest_is_4b | functest_is_4a (1 row) -SELECT routine_name, sequence_name FROM information_schema.routine_sequence_usage ORDER BY 1, 2; +SELECT routine_name, sequence_name FROM information_schema.routine_sequence_usage + WHERE routine_schema = 'temp_func_test' + ORDER BY 1, 2; routine_name | sequence_name ---------------+--------------- functest_is_5 | functest1 functest_is_6 | functest1 (2 rows) -SELECT routine_name, table_name, column_name FROM information_schema.routine_column_usage ORDER BY 1, 2; +SELECT routine_name, table_name, column_name FROM information_schema.routine_column_usage + WHERE routine_schema = 'temp_func_test' + ORDER BY 1, 2; routine_name | table_name | column_name ---------------+------------+------------- functest_is_7 | functest2 | a (1 row) -SELECT routine_name, table_name FROM information_schema.routine_table_usage ORDER BY 1, 2; +SELECT routine_name, table_name FROM information_schema.routine_table_usage + WHERE routine_schema = 'temp_func_test' + ORDER BY 1, 2; routine_name | table_name ---------------+------------ functest_is_7 | functest2 diff --git a/src/test/regress/sql/create_function_3.sql b/src/test/regress/sql/create_function_3.sql index 3575ecc6932..592a43b5ed2 100644 --- a/src/test/regress/sql/create_function_3.sql +++ b/src/test/regress/sql/create_function_3.sql @@ -277,10 +277,18 @@ SELECT r0.routine_name, r1.routine_name FROM information_schema.routine_routine_usage rru JOIN information_schema.routines r0 ON r0.specific_name = rru.specific_name JOIN information_schema.routines r1 ON r1.specific_name = rru.routine_name + WHERE r0.routine_schema = 'temp_func_test' AND + r1.routine_schema = 'temp_func_test' + ORDER BY 1, 2; +SELECT routine_name, sequence_name FROM information_schema.routine_sequence_usage + WHERE routine_schema = 'temp_func_test' + ORDER BY 1, 2; +SELECT routine_name, table_name, column_name FROM information_schema.routine_column_usage + WHERE routine_schema = 'temp_func_test' + ORDER BY 1, 2; +SELECT routine_name, table_name FROM information_schema.routine_table_usage + WHERE routine_schema = 'temp_func_test' ORDER BY 1, 2; -SELECT routine_name, sequence_name FROM information_schema.routine_sequence_usage ORDER BY 1, 2; -SELECT routine_name, table_name, column_name FROM information_schema.routine_column_usage ORDER BY 1, 2; -SELECT routine_name, table_name FROM information_schema.routine_table_usage ORDER BY 1, 2; DROP FUNCTION functest_IS_4a CASCADE; DROP SEQUENCE functest1 CASCADE;