{"record":{"id":"f12a2f3581f02d29","repo":"iflytek/astron-agent","slug":"8513-database-table-update-failed","errorCode":"8513","errorMessage":"database.table.update.failed","messagePattern":"database\\.table\\.update\\.failed","errorType":"error_code","errorClass":"BusinessException","httpStatus":null,"severity":"error","filePath":"console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/database/DatabaseService.java","lineNumber":466,"sourceCode":"                    }\n                }\n            }\n            if (StringUtils.isNotBlank(dbTableDto.getName())) {\n                dbTable.setName(dbTableDto.getName());\n            }\n            if (StringUtils.isNotBlank(dbTableDto.getDescription())) {\n                dbTable.setDescription(dbTableDto.getDescription());\n            }\n            dbTable.setUpdateTime(new Date());\n            dbTableMapper.updateById(dbTable);\n            String userId = UserInfoManagerHandler.getUserId();\n            for (String stmt : safeSplitStatements(ddl)) {\n                coreSystemService.execDDL(stmt, userId, SpaceInfoUtil.getSpaceId(), dbInfo.getDbId());\n            }\n\n        } catch (Exception ex) {\n            log.info(\"Failed to update table, params={}\", dbTableDto.toString(), ex);\n            throw new BusinessException(ResponseEnum.DATABASE_TABLE_UPDATE_FAILED);\n        }\n    }\n\n    private String buildDDL(DbTableDto dbTableDto, Integer type, String originTbName) {\n        StringBuilder ddl = new StringBuilder();\n\n        if (DBOperateEnum.INSERT.getCode().equals(type)) {\n            List<DbTableFieldDto> fields = dbTableDto.getFields()\n                    .stream()\n                    .filter(f -> !Arrays.asList(SYSTEM_FIELDS).contains(f.getName()))\n                    .collect(Collectors.toList());\n\n            List<ColumnDef> columns = fields.stream()\n                    .map(f -> new ColumnDef(\n                            f.getName(),\n                            transFormType(f.getType()),\n                            Boolean.TRUE.equals(f.getIsRequired()),\n                            StringUtils.isNotBlank(f.getDefaultValue())","sourceCodeStart":448,"sourceCodeEnd":484,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/backend/toolkit/src/main/java/com/iflytek/astron/console/toolkit/service/database/DatabaseService.java#L448-L484","documentation":"Generic failure thrown by DatabaseService.updateTable when any part of the table update fails — the outer catch (Exception) at line 464-467 rethrows as DATABASE_TABLE_UPDATE_FAILED. This includes DDL generation, remote execDDL against the core system, and metadata updates. Root cause is logged at info level ('Failed to update table').","triggerScenarios":"Any exception in updateTable: physical DDL rejected (rename to existing physical table, invalid column type/name, reserved keywords), core system execDDL failure, permission/data check failure, or concurrent update conflicts.","commonSituations":"Renaming a column to a reserved SQL keyword; core system service unavailable; target database rejects ALTER statements (insufficient DDL privileges on the physical DB); updating a table whose physical counterpart was dropped manually.","solutions":["Check backend logs for 'Failed to update table, params=' to find the root cause","Verify the core system service is reachable and execDDL succeeds","Avoid reserved keywords and unsupported types in renamed/new fields","Confirm the physical table still exists in the target database and DDL privileges are granted","Retry after correcting the underlying issue"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// pre-flight: unique name, valid field names/types, no reserved keywords\nassert !RESERVED_KEYWORDS.contains(newName.toUpperCase());","typeGuard":null,"tryCatchPattern":"try {\n    databaseService.updateTable(dto);\n} catch (BusinessException e) {\n    // inspect server log 'Failed to update table, params=' for root cause\n    log.error(\"updateTable failed for id={}\", dto.getId(), e);\n    throw e;\n}","preventionTips":["Avoid reserved keywords in renamed/new column names","Verify core system execDDL availability before batch updates","Confirm physical DDL privileges on the target database","Don't manually drop physical tables that are managed by the platform"],"tags":["database","ddl","update-failed"],"backgroundTag":"database-write-failed","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-19T12:17:13.211Z"}