apache/shardingsphere · error · PostgreSQLProtocolException
Can not find value `%s` in PostgreSQL column type.
Error message
Can not find value `%s` in PostgreSQL column type.
What it means
Thrown by PostgreSQLBinaryColumnType.valueOf(int) when the integer value does not match any enum constant. The PostgreSQL wire protocol identifies column types by integer type OIDs; this lookup maps an OID received in a packet (e.g. from a Bind/Describe exchange or a client-driven extended query) to the known binary column type set. An unknown OID means the peer sent a type identifier this build of the protocol dialect does not recognize.
Source
Thrown at database/protocol/dialect/postgresql/src/main/java/org/apache/shardingsphere/database/protocol/postgresql/packet/command/query/extended/PostgreSQLBinaryColumnType.java:279
*/
public static boolean isUUID(final int jdbcType, final String columnTypeName) {
return Types.OTHER == jdbcType && "uuid".equalsIgnoreCase(columnTypeName);
}
/**
* Value of.
*
* @param value value
* @return PostgreSQL column type
* @throws PostgreSQLProtocolException PostgreSQL protocol exception
*/
public static PostgreSQLBinaryColumnType valueOf(final int value) {
for (PostgreSQLBinaryColumnType each : values()) {
if (value == each.value) {
return each;
}
}
throw new PostgreSQLProtocolException("Can not find value `%s` in PostgreSQL column type.", value);
}
}
View on GitHub (pinned to e952770a21)
Solutions
- Check which type OID the client actually sent (enable protocol/packet logging) and identify the PostgreSQL type it maps to
- Upgrade ShardingSphere to a version whose protocol dialect knows that OID
- If the OID is a custom/extension type, bind the parameter as text format or cast it to a supported built-in type in the SQL
- File an issue with the OID value so the enum can be extended
Defensive patterns
Strategy: validation
Validate before calling
int oid = ...; // from packet
boolean known = java.util.Arrays.stream(PostgreSQLBinaryColumnType.values()).anyMatch(t -> t.getValue() == oid);
if (!known) { /* reject or fall back to text format before binding */ } Try / catch
catch (PostgreSQLProtocolException e) { if (e.getMessage().contains("PostgreSQL column type")) { /* log OID, fall back to text parameter format */ } throw e; } Prevention
- Prefer text format for bind parameters of custom/extension types
- Keep ShardingSphere version aligned with the newest PostgreSQL server you proxy
- Log unknown OIDs once at protocol level to detect client/driver mismatches early
When it happens
Trigger: A client or upstream driver sends a Parse/Bind/Describe message whose parameter or result column type OID is not one of the OIDs enumerated in PostgreSQLBinaryColumnType (e.g. a newly added PostgreSQL type OID, or a custom type), and the packet parser calls PostgreSQLBinaryColumnType.valueOf(value) while decoding.
Common situations: Using a PostgreSQL server/driver version newer than the ShardingSphere build (new OIDs), proxying custom extension types, or a malformed/fuzzed packet containing garbage type integers.
Related errors
- Connection [%s] is not registered.
- BLR is too short: %s
- Can not find value `%s` in new parameters bound flag.
- Unsupported PostgreSQL format code `%s`
- Can not find `%s` in PostgreSQL command packet type.
AI-assisted analysis of apache/shardingsphere@e952770a21 (2026-08-14).
Data as JSON: /api/errors/85580ca02890b668.
Report an issue: GitHub.