Skip to content

Commit

Permalink
Add getDataLength for numeric without precision
Browse files Browse the repository at this point in the history
  • Loading branch information
shin1103 committed Oct 16, 2024
1 parent 99d8603 commit 5bfe0e8
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
public class PostgreSQLOutputConnection
extends JdbcOutputConnection
{
private static final int MIN_NUMERIC_PRECISION = 1;
private static final int MAX_NUMERIC_PRECISION = 1000;

public PostgreSQLOutputConnection(Connection connection, String schemaName, String roleName)
Expand Down Expand Up @@ -263,9 +264,9 @@ protected String buildColumnTypeName(JdbcColumn c)
}
break;
case "NUMERIC": // only "NUMERIC" because PostgreSQL JDBC driver will return also "NUMERIC" for the type name of decimal.
if (c.getDataLength() > MAX_NUMERIC_PRECISION) {
// getDataLength for numeric without precision will return 131089 .
// but cannot create column of numeric(131089) .
if (c.getDataLength() > MAX_NUMERIC_PRECISION || c.getDataLength() < MIN_NUMERIC_PRECISION) {
// getDataLength for numeric without precision will return 0 or 131089 .
// but cannot create column of numeric(0) and numeric(131089) .
return "NUMERIC";
}
break;
Expand Down

0 comments on commit 5bfe0e8

Please sign in to comment.