diff --git a/.changes/unreleased/Fixes-20230425-155445.yaml b/.changes/unreleased/Fixes-20230425-155445.yaml new file mode 100644 index 00000000000..9ce0ea2332f --- /dev/null +++ b/.changes/unreleased/Fixes-20230425-155445.yaml @@ -0,0 +1,7 @@ +kind: Fixes +body: '[CT-2343] [Bug] snapshot with custom datatypes breaks when source table is + regenerated' +time: 2023-04-25T15:54:45.1782743+01:00 +custom: + Author: benorourke + Issue: "7248" diff --git a/plugins/postgres/dbt/include/postgres/macros/adapters.sql b/plugins/postgres/dbt/include/postgres/macros/adapters.sql index 07892f35b4b..f09efaac2cb 100644 --- a/plugins/postgres/dbt/include/postgres/macros/adapters.sql +++ b/plugins/postgres/dbt/include/postgres/macros/adapters.sql @@ -60,7 +60,10 @@ {% call statement('get_columns_in_relation', fetch_result=True) %} select column_name, - data_type, + case + when (data_type = 'USER-DEFINED') then concat(udt_schema || '.' || udt_name) + else data_type + end as data_type, character_maximum_length, numeric_precision, numeric_scale