Skip to content

Commit

Permalink
Add support for Postgres UDTs in postgres__get_columns_in_relation
Browse files Browse the repository at this point in the history
  • Loading branch information
benorourke committed Apr 25, 2023
1 parent 2739d5f commit f5aa4c2
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions plugins/postgres/dbt/include/postgres/macros/adapters.sql
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,14 @@
{% macro postgres__get_columns_in_relation(relation) -%}
{% call statement('get_columns_in_relation', fetch_result=True) %}
select
column_name,
data_type,
case
when (data_type = 'USER-DEFINED') then udt_name
else column_name
end as column_name,
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
Expand Down

0 comments on commit f5aa4c2

Please sign in to comment.