From 38ce05240288f802d5d4910c1c90994364107646 Mon Sep 17 00:00:00 2001 From: Piotr Findeisen Date: Fri, 29 Sep 2023 21:15:19 +0200 Subject: [PATCH] Remove redundant `DISTINCT` from schema listing query `information_schema.schemata` has no duplicates. --- .changes/unreleased/Under the Hood-20230929-211758.yaml | 7 +++++++ dbt/include/trino/macros/adapters.sql | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 .changes/unreleased/Under the Hood-20230929-211758.yaml diff --git a/.changes/unreleased/Under the Hood-20230929-211758.yaml b/.changes/unreleased/Under the Hood-20230929-211758.yaml new file mode 100644 index 00000000..e23b417a --- /dev/null +++ b/.changes/unreleased/Under the Hood-20230929-211758.yaml @@ -0,0 +1,7 @@ +kind: Under the Hood +body: Remove redundant DISTINCT from schema listing query +time: 2023-09-29T21:17:58.859993+02:00 +custom: + Author: findepi + Issue: "" + PR: "356" diff --git a/dbt/include/trino/macros/adapters.sql b/dbt/include/trino/macros/adapters.sql index 3f487123..24bf37c8 100644 --- a/dbt/include/trino/macros/adapters.sql +++ b/dbt/include/trino/macros/adapters.sql @@ -215,7 +215,7 @@ {% macro trino__list_schemas(database) -%} {% call statement('list_schemas', fetch_result=True, auto_begin=False) %} - select distinct schema_name + select schema_name from {{ information_schema_name(database) }}.schemata {% endcall %} {{ return(load_result('list_schemas').table) }}