Skip to content

Commit

Permalink
Infer the domain types type as the underlying type
Browse files Browse the repository at this point in the history
  • Loading branch information
Limess authored Jul 19, 2020
1 parent e990e88 commit 3419067
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions tap_postgres/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,6 @@ def produce_table_info(conn):
with conn.cursor(cursor_factory=psycopg2.extras.DictCursor, name='stitch_cursor') as cur:
cur.itersize = post_db.cursor_iter_size
table_info = {}
# SELECT CASE WHEN $2.typtype = 'd' THEN $2.typbasetype ELSE $1.atttypid END
cur.execute("""
SELECT
pg_class.reltuples::BIGINT AS approximate_row_count,
Expand All @@ -244,7 +243,7 @@ def produce_table_info(conn):
pg_class.relname AS table_name,
attname AS column_name,
i.indisprimary AS primary_key,
format_type(a.atttypid, NULL::integer) AS data_type,
format_type(CASE WHEN pgt.typtype = 'd' THEN pgt.typbasetype ELSE a.atttypid END, NULL::integer) AS data_type,
information_schema._pg_char_max_length(CASE WHEN COALESCE(subpgt.typtype, pgt.typtype) = 'd'
THEN COALESCE(subpgt.typbasetype, pgt.typbasetype) ELSE COALESCE(subpgt.oid, pgt.oid)
END,
Expand Down

0 comments on commit 3419067

Please sign in to comment.