apache/shardingsphere · error · UnsupportedSQLOperationException
Unsupported Firebird format code `%s`
Error message
Unsupported Firebird format code `%s`
What it means
MySQL error 1295 (ER_UNSUPPORTED_PS) thrown by MySQLComStmtExecuteExecutor while reconstructing parameter types for COM_STMT_EXECUTE. When the packet carries no new parameter types and no cached types exist, the executor can only proceed if every expected parameter is marked NULL in the null bitmap; otherwise it cannot infer the wire type of a non-NULL parameter and throws UnsupportedPreparedStatementException.
Source
Thrown at database/protocol/dialect/firebird/src/main/java/org/apache/shardingsphere/database/protocol/firebird/constant/FirebirdValueFormat.java:57
STRING(4);
private final int code;
/**
* Value of.
*
* @param code format code
* @return Firebird value format
* @throws UnsupportedSQLOperationException unsupported SQL operation exception
*/
public static FirebirdValueFormat valueOf(final int code) {
switch (code) {
case 0:
return TEXT;
case 1:
return BINARY;
default:
throw new UnsupportedSQLOperationException(String.format("Unsupported Firebird format code `%s`", code));
}
}
}
View on GitHub (pinned to e952770a21)
Solutions
- Use a mainstream, up-to-date MySQL driver (Connector/J, mysql-connector-python, etc.) that always sends parameter types on the first COM_STMT_EXECUTE after prepare.
- Ensure at least one execution includes new parameter types so the executor caches them for subsequent executions.
- If writing a custom client, populate the new_parameter_types block or set every unused parameter NULL in the null bitmap.
- Check that the SQL sent at prepare time really has the parameter count the client assumes at execute time (server-side and client-side counts must agree).
Example fix
// before (custom binary-protocol client): execute with types omitted stmtExecute(null_bitmap, values, /* new_parameter_types */ null); // after: send types on first execution after prepare stmtExecute(null_bitmap, values, List.of(new MySQLPreparedStatementParameterType(VAR_STRING, 0)));
Defensive patterns
Strategy: validation
Validate before calling
// Custom binary-protocol client: send types on first execute after prepare
if (!typesSentForStatement.containsKey(stmtId)) {
executePacket.withNewParameterTypes(inferTypesFromBoundValues(values));
typesSentForStatement.put(stmtId, true);
} Try / catch
// Vendor code 1295 = ER_UNSUPPORTED_PS; not retryable as-is
try {
stmt.execute();
} catch (SQLException e) {
if (e.getErrorCode() == 1295) {
// re-prepare and retry once WITH explicit parameter types
stmt = rePrepareSendingTypes(sql, values);
return stmt.execute();
}
throw e;
} Prevention
- Use maintained drivers that populate new_parameter_types on first COM_STMT_EXECUTE.
- Mark all unused parameters NULL in the null bitmap when types are omitted.
- Keep prepare-time and execute-time parameter counts consistent.
When it happens
Trigger: Executing a prepared statement whose SQL declares parameters, where the COM_STMT_EXECUTE packet omits parameter types (first-execution types were not supplied/cached) and at least one parameter is non-NULL in the null bitmap, or the null bitmap itself is missing.
Common situations: Client drivers that skip re-sending parameter types on later executions; hand-crafted binary-protocol clients; drivers after an upgrade changing when they include new_parameter_types; statements whose parameter count from the parsed SQL disagrees with what the client sends.
Related errors
- 6
- Unsupported format type %s
- Can not find value `%s` in new parameters bound flag.
- Can not support date format if year, month, day is absent.
- Wrong length `%d` of MYSQL_TYPE_TIME
AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14).
Data as JSON: /api/errors/d4c2ea923c6e233c.
Report an issue: GitHub.