File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
embulk-output-postgresql/src/main/java/org/embulk/output/postgresql Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change 16
16
public class PostgreSQLOutputConnection
17
17
extends JdbcOutputConnection
18
18
{
19
+ private static final int MIN_NUMERIC_PRECISION = 0 ;
19
20
private static final int MAX_NUMERIC_PRECISION = 1000 ;
20
21
21
22
public PostgreSQLOutputConnection (Connection connection , String schemaName , String roleName )
@@ -263,9 +264,9 @@ protected String buildColumnTypeName(JdbcColumn c)
263
264
}
264
265
break ;
265
266
case "NUMERIC" : // only "NUMERIC" because PostgreSQL JDBC driver will return also "NUMERIC" for the type name of decimal.
266
- if (c .getDataLength () > MAX_NUMERIC_PRECISION ) {
267
- // getDataLength for numeric without precision will return 131089 .
268
- // but cannot create column of numeric(131089) .
267
+ if (c .getDataLength () > MAX_NUMERIC_PRECISION || c . getDataLength () < MIN_NUMERIC_PRECISION ) {
268
+ // getDataLength for numeric without precision will return 0 or 131089 .
269
+ // but cannot create column of numeric(0) and numeric( 131089) .
269
270
return "NUMERIC" ;
270
271
}
271
272
break ;
You can’t perform that action at this time.
0 commit comments