mirror of
https://github.com/postgres/postgres.git
synced 2025-05-05 09:19:17 +03:00
Add DISTINCT to information schema usage views
Since pg_depend can contain duplicate entries, we need to eliminate those in information schema views that build on pg_depend, using DISTINCT. Some of the older views already did that correctly, but some of the more recently added ones didn't. (In some of these views, it might not be possible to reproduce the issue because of how the implementation happens to deduplicate dependencies while recording them, but it seems better to keep this consistent in all cases.)
This commit is contained in:
parent
39d0928a0e
commit
d84ffffe58
@ -406,7 +406,8 @@ GRANT SELECT ON character_sets TO PUBLIC;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
CREATE VIEW check_constraint_routine_usage AS
|
CREATE VIEW check_constraint_routine_usage AS
|
||||||
SELECT CAST(current_database() AS sql_identifier) AS constraint_catalog,
|
SELECT DISTINCT
|
||||||
|
CAST(current_database() AS sql_identifier) AS constraint_catalog,
|
||||||
CAST(nc.nspname AS sql_identifier) AS constraint_schema,
|
CAST(nc.nspname AS sql_identifier) AS constraint_schema,
|
||||||
CAST(c.conname AS sql_identifier) AS constraint_name,
|
CAST(c.conname AS sql_identifier) AS constraint_name,
|
||||||
CAST(current_database() AS sql_identifier) AS specific_catalog,
|
CAST(current_database() AS sql_identifier) AS specific_catalog,
|
||||||
@ -505,7 +506,8 @@ GRANT SELECT ON collation_character_set_applicability TO PUBLIC;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
CREATE VIEW column_column_usage AS
|
CREATE VIEW column_column_usage AS
|
||||||
SELECT CAST(current_database() AS sql_identifier) AS table_catalog,
|
SELECT DISTINCT
|
||||||
|
CAST(current_database() AS sql_identifier) AS table_catalog,
|
||||||
CAST(n.nspname AS sql_identifier) AS table_schema,
|
CAST(n.nspname AS sql_identifier) AS table_schema,
|
||||||
CAST(c.relname AS sql_identifier) AS table_name,
|
CAST(c.relname AS sql_identifier) AS table_name,
|
||||||
CAST(ac.attname AS sql_identifier) AS column_name,
|
CAST(ac.attname AS sql_identifier) AS column_name,
|
||||||
@ -1325,7 +1327,8 @@ GRANT SELECT ON role_column_grants TO PUBLIC;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
CREATE VIEW routine_column_usage AS
|
CREATE VIEW routine_column_usage AS
|
||||||
SELECT CAST(current_database() AS sql_identifier) AS specific_catalog,
|
SELECT DISTINCT
|
||||||
|
CAST(current_database() AS sql_identifier) AS specific_catalog,
|
||||||
CAST(np.nspname AS sql_identifier) AS specific_schema,
|
CAST(np.nspname AS sql_identifier) AS specific_schema,
|
||||||
CAST(nameconcatoid(p.proname, p.oid) AS sql_identifier) AS specific_name,
|
CAST(nameconcatoid(p.proname, p.oid) AS sql_identifier) AS specific_name,
|
||||||
CAST(current_database() AS sql_identifier) AS routine_catalog,
|
CAST(current_database() AS sql_identifier) AS routine_catalog,
|
||||||
@ -1434,7 +1437,8 @@ GRANT SELECT ON role_routine_grants TO PUBLIC;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
CREATE VIEW routine_routine_usage AS
|
CREATE VIEW routine_routine_usage AS
|
||||||
SELECT CAST(current_database() AS sql_identifier) AS specific_catalog,
|
SELECT DISTINCT
|
||||||
|
CAST(current_database() AS sql_identifier) AS specific_catalog,
|
||||||
CAST(np.nspname AS sql_identifier) AS specific_schema,
|
CAST(np.nspname AS sql_identifier) AS specific_schema,
|
||||||
CAST(nameconcatoid(p.proname, p.oid) AS sql_identifier) AS specific_name,
|
CAST(nameconcatoid(p.proname, p.oid) AS sql_identifier) AS specific_name,
|
||||||
CAST(current_database() AS sql_identifier) AS routine_catalog,
|
CAST(current_database() AS sql_identifier) AS routine_catalog,
|
||||||
@ -1462,7 +1466,8 @@ GRANT SELECT ON routine_routine_usage TO PUBLIC;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
CREATE VIEW routine_sequence_usage AS
|
CREATE VIEW routine_sequence_usage AS
|
||||||
SELECT CAST(current_database() AS sql_identifier) AS specific_catalog,
|
SELECT DISTINCT
|
||||||
|
CAST(current_database() AS sql_identifier) AS specific_catalog,
|
||||||
CAST(np.nspname AS sql_identifier) AS specific_schema,
|
CAST(np.nspname AS sql_identifier) AS specific_schema,
|
||||||
CAST(nameconcatoid(p.proname, p.oid) AS sql_identifier) AS specific_name,
|
CAST(nameconcatoid(p.proname, p.oid) AS sql_identifier) AS specific_name,
|
||||||
CAST(current_database() AS sql_identifier) AS routine_catalog,
|
CAST(current_database() AS sql_identifier) AS routine_catalog,
|
||||||
@ -1493,7 +1498,8 @@ GRANT SELECT ON routine_sequence_usage TO PUBLIC;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
CREATE VIEW routine_table_usage AS
|
CREATE VIEW routine_table_usage AS
|
||||||
SELECT CAST(current_database() AS sql_identifier) AS specific_catalog,
|
SELECT DISTINCT
|
||||||
|
CAST(current_database() AS sql_identifier) AS specific_catalog,
|
||||||
CAST(np.nspname AS sql_identifier) AS specific_schema,
|
CAST(np.nspname AS sql_identifier) AS specific_schema,
|
||||||
CAST(nameconcatoid(p.proname, p.oid) AS sql_identifier) AS specific_name,
|
CAST(nameconcatoid(p.proname, p.oid) AS sql_identifier) AS specific_name,
|
||||||
CAST(current_database() AS sql_identifier) AS routine_catalog,
|
CAST(current_database() AS sql_identifier) AS routine_catalog,
|
||||||
|
@ -53,6 +53,6 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* yyyymmddN */
|
/* yyyymmddN */
|
||||||
#define CATALOG_VERSION_NO 202104201
|
#define CATALOG_VERSION_NO 202104211
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user