apache/seatunnel · warning

Column ' ' not found in .COLUMNS for table ; assuming NOT…

Error message

Column '{}' not found in {}.COLUMNS for table {}; assuming NOT NULL

What it means

While deciding whether an ALTER COLUMN statement needs NULL/NOT NULL, the dialect queries INFORMATION_SCHEMA.COLUMNS for the target column. If the row is absent, the code conservatively assumes the column is NOT NULL (so it will not append NULL) and logs a warning instead of failing.

Solutions

  1. Verify the tablePath and column name match exactly what is in INFORMATION_SCHEMA.COLUMNS (including case and schema/database prefix).
  2. Check that the connection points at the intended database/catalog; the infoSchemaPrefix must resolve to the right DB.
  3. Run the generated SELECT against the target DB manually to see why the column row is missing.
  4. Ensure the table exists before schema evolution runs (ordering issue in the DDL plan).

Example fix

// before: column name case mismatch
column = "UserId"; // actual DB column: user_id
// after
column = "user_id"; // match INFORMATION_SCHEMA.COLUMNS exactly
Defensive patterns

Strategy: validation

Validate before calling

// Verify the column exists before schema evolution:
SELECT COLUMN_NAME, IS_NULLABLE FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_SCHEMA = ? AND TABLE_NAME = ? AND COLUMN_NAME = ?;

Try / catch

try { applySchemaChange(...); } catch (SQLException e) { log.warn("Column metadata lookup may have missed; verify name/case in INFORMATION_SCHEMA.COLUMNS", e); }

Prevention

When it happens

Trigger: columnIsNullable is called during applySchemaChange on a SQL Server connection whose SELECT from <prefix>.COLUMNS (with the dialect's WHERE clause) returns no row — typically a typo'd schema/table/column name, wrong infoSchemaPrefix (wrong database), or case/name mismatch (e.g. bracketed or quoted naming differences).

Common situations: Schema evolution targeting a different database than expected (missing database prefix), column renamed upstream so the metadata lookup misses, temporary/staging tables not yet visible in INFORMATION_SCHEMA, case-sensitive collation mismatches.

Understand the failure class

Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.

Related errors


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/a3010d482ab84837. Report an issue: GitHub.

Appendix: source

Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/dialect/sqlserver/SqlServerDialect.java:551

    private boolean columnIsNullable(Connection connection, TablePath tablePath, String column)
            throws SQLException {
        // Prefix with the target database name so the query works even when the JDBC connection
        // is connected to a different database (e.g. master with no databaseName in the URL).
        String databaseName = tablePath.getDatabaseName();
        String infoSchemaPrefix =
                StringUtils.isNotBlank(databaseName)
                        ? quoteDatabaseIdentifier(databaseName) + ".INFORMATION_SCHEMA"
                        : "INFORMATION_SCHEMA";
        String selectColumnSQL =
                String.format(
                        "SELECT IS_NULLABLE FROM %s.COLUMNS WHERE %s AND COLUMN_NAME = '%s';",
                        infoSchemaPrefix, buildCommonWhereClause(tablePath), column);
        try (Statement statement = connection.createStatement()) {
            ResultSet rs = statement.executeQuery(selectColumnSQL);
            if (!rs.next()) {
                // Column not found — default to non-nullable to avoid incorrectly appending
                // NULL to an ALTER COLUMN statement for a column that doesn't allow nulls.
                log.warn(
                        "Column '{}' not found in {}.COLUMNS for table {}; assuming NOT NULL",
                        column,
                        infoSchemaPrefix,
                        tablePath.getFullName());
                return false;
            }
            return rs.getString("IS_NULLABLE").equals("YES");
        }
    }

    /**
     * Returns the SQL column type string to use in DDL statements.
     *
     * <p>When source and sink are the same catalog (SQL Server to SQL Server) we prefer the
     * original {@code sourceType} because it already carries the full type expression (e.g. {@code
     * varchar(255)}). However, when the CDC schema-change path produces a column whose {@code
     * sourceType} is a bare type name without length/precision (e.g. {@code varchar} instead of
     * {@code varchar(255)}), SQL Server rejects the resulting DDL statement. In that case we fall

View on GitHub (pinned to cf67b549a7)