MyCATApache/Mycat-Server · error · SQLNonTransientException
"Parent relevant column can't be updated " + tableName +…
Error message
"Parent relevant column can't be updated " + tableName + "->" + joinKey
What it means
When a table has a parent (child table of an ER-join relationship), the joinKey column linking it to the parent must stay consistent for Mycat's ER routing. confirmShardColumnNotUpdated rejects any UPDATE whose SET clause modifies the joinKey with SQLNonTransientException, because it would break child-row co-location with the parent.
Solutions
- Exclude the joinKey from the SET clause; re-parent via DELETE from the old parent's child set + INSERT under the new parent
- Update only non-join-key columns in the statement
- Restructure ER relations if re-parenting is a frequent business operation
Example fix
-- before UPDATE order_detail SET order_id = 999 WHERE detail_id = 55; -- after INSERT INTO order_detail (detail_id, order_id, ...) VALUES (55, 999, ...); DELETE FROM order_detail WHERE detail_id = 55; -- remove from old parent's shard
Defensive patterns
Strategy: validation
Validate before calling
if (isChildTable(table) && updateSetColumns.contains(childConfig.getJoinKey())) {
throw new IllegalArgumentException("joinKey " + childConfig.getJoinKey() + " is not updatable");
} Try / catch
try { executeUpdate(sql); } catch (SQLNonTransientException e) { if (e.getMessage().startsWith("Parent relevant column can't be updated")) { doDeleteInsertInstead(); } else throw e; } Prevention
- Exclude joinKey columns from entity update statements
- Re-parent child rows via delete+insert
- Configure join keys on immutable identifier columns
- Filter ORM update payloads to mutable business fields only
When it happens
Trigger: An UPDATE on a child table (configured with <childTable parent="..." joinKey="...">) whose SET clause assigns to the joinKey column (e.g. `UPDATE order_detail SET order_id=999 WHERE ...`).
Common situations: Re-parenting child rows to a different parent row; data-fix scripts rewriting foreign-key columns on ER-sharded child tables; ORMs syncing the whole entity including the FK.
Understand the failure class
Background: UnsupportedOperationException and "is not supported" errors: when a library deliberately refuses a call — this error's family across 30 libraries.
Related errors
- "multi table related update not supported,tables:" +…
- "Sharding column can't be updated " + tableName + "->" +…
- multi table related update not supported,tables:
- global table is not supported in multi table related update
- Unhandled SQL AST node type encountered:
AI-assisted analysis of MyCATApache/Mycat-Server@65f8d8beb7 (2026-09-11).
Data as JSON: /api/errors/b113d75d9fd32762.
Report an issue: GitHub.
Appendix: source
Thrown at src/main/java/io/mycat/route/parser/druid/impl/DruidUpdateParser.java:241
if (column.contains(StringUtil.TABLE_COLUMN_SEPARATOR)) {
column = column.substring(column.indexOf(".") + 1).trim().toUpperCase();
}
if (partitionColumn != null && partitionColumn.equals(column)) {
boolean canUpdate;
canUpdate = ((update.getWhere() != null) && shardColCanBeUpdated(update.getWhere(),
partitionColumn, item.getValue(), false));
if (!canUpdate) {
String msg = "Sharding column can't be updated " + tableName + "->" + partitionColumn;
LOGGER.warn(msg);
throw new SQLNonTransientException(msg);
}
}
if (hasParent) {
if (column.equals(joinKey)) {
String msg = "Parent relevant column can't be updated " + tableName + "->" + joinKey;
LOGGER.warn(msg);
throw new SQLNonTransientException(msg);
}
rrs.setCacheAble(true);
}
}
}
}
}
View on GitHub (pinned to 65f8d8beb7)