src/main/java/org/embulk/output/postgresql/PostgreSQLOutputConnection.java in embulk-output-postgresql-0.7.4 vs src/main/java/org/embulk/output/postgresql/PostgreSQLOutputConnection.java in embulk-output-postgresql-0.7.5

- old
+ new

@@ -13,10 +13,12 @@ import org.embulk.output.jdbc.JdbcSchema; public class PostgreSQLOutputConnection extends JdbcOutputConnection { + private static final int MAX_NUMERIC_PRECISION = 1000; + public PostgreSQLOutputConnection(Connection connection, String schemaName, boolean autoCommit) throws SQLException { super(connection, schemaName); connection.setAutoCommit(autoCommit); @@ -249,10 +251,19 @@ if (c.getDataLength() == Integer.MAX_VALUE) { // getDataLength for varchar without length specifier will return 2147483647 . // but cannot create column of varchar(2147483647) . return "VARCHAR"; } + 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) . + return "NUMERIC"; + } + break; default: - return super.buildColumnTypeName(c); + break; } + return super.buildColumnTypeName(c); } }