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

Commit 07533a2

Browse files
committed
Fix for more than 50 fields in Postgres
Postgres does not allow functions that have more that 100 arguments. When using the concat function this limits comparisons for more than 50 fields. Using `||` for concat like the Oracle variant fixes this.
1 parent 2697d3a commit 07533a2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

data_diff/sqeleton/databases/postgresql.py

+5
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from typing import List
12
from ..abcs.database_types import (
23
DbPath,
34
JSON,
@@ -92,6 +93,10 @@ def quote(self, s: str):
9293
def to_string(self, s: str):
9394
return f"{s}::varchar"
9495

96+
def concat(self, items: List[str]) -> str:
97+
joined_exprs = " || ".join(items)
98+
return f"({joined_exprs})"
99+
95100
def _convert_db_precision_to_digits(self, p: int) -> int:
96101
# Subtracting 2 due to wierd precision issues in PostgreSQL
97102
return super()._convert_db_precision_to_digits(p) - 2

0 commit comments

Comments
 (0)