Skip to content
This repository was archived by the owner on May 17, 2024. It is now read-only.

Commit 781d2ea

Browse files
committed
fix failing pg tests
1 parent 8f091e8 commit 781d2ea

1 file changed

Lines changed: 16 additions & 14 deletions

File tree

data_diff/databases/postgresql.py

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -190,21 +190,23 @@ def select_table_schema(self, path: DbPath) -> str:
190190
if database:
191191
info_schema_path.insert(0, database)
192192

193-
return f"""
194-
SELECT column_name, data_type, datetime_precision,
195-
CASE
196-
WHEN data_type = 'numeric'
197-
THEN coalesce(numeric_precision, 131072 + 16383)
198-
ELSE numeric_precision
199-
END AS numeric_precision,
200-
CASE
201-
WHEN data_type = 'numeric'
202-
THEN coalesce(numeric_scale, 16383)
203-
ELSE numeric_scale
204-
END AS numeric_scale
205-
FROM {'.'.join(info_schema_path)}
206-
WHERE table_name = '{table}' AND table_schema = '{schema}'
193+
return (
194+
f"""SELECT column_name, data_type, datetime_precision,
195+
-- see comment for DEFAULT_NUMERIC_PRECISION
196+
CASE
197+
WHEN data_type = 'numeric'
198+
THEN coalesce(numeric_precision, 131072 + {self.dialect.DEFAULT_NUMERIC_PRECISION})
199+
ELSE numeric_precision
200+
END AS numeric_precision,
201+
CASE
202+
WHEN data_type = 'numeric'
203+
THEN coalesce(numeric_scale, {self.dialect.DEFAULT_NUMERIC_PRECISION})
204+
ELSE numeric_scale
205+
END AS numeric_scale
206+
FROM {'.'.join(info_schema_path)}
207+
WHERE table_name = '{table}' AND table_schema = '{schema}'
207208
"""
209+
)
208210

209211
def select_table_unique_columns(self, path: DbPath) -> str:
210212
database, schema, table = self._normalize_table_path(path)

0 commit comments

Comments
 (0)