lealone / Lealone

比 MySQL 和 MongoDB 快10倍的 OLTP 关系数据库和文档数据库
Other
2.44k stars 513 forks source link

有外键的时候,drop table后再create table 报错 #137

Closed gongsongping closed 2 years ago

gongsongping commented 2 years ago
表里外键FOREIGN KEY(user_id) REFERENCES users(id), drop table 后再create table 报错:

Exception in thread "main" org.lealone.common.exceptions.JdbcSQLException: General error: "java.lang.RuntimeException: not found: CONSTRAINT_8"; SQL statement: RUNSCRIPT FROM '../hll-dal/src/main/resources/tables1.sql' [50000-0] at org.lealone.common.exceptions.DbException.getJdbcSQLException(DbException.java:340) at org.lealone.common.exceptions.DbException.get(DbException.java:161) at org.lealone.common.exceptions.DbException.convert(DbException.java:292) at org.lealone.sql.executor.YieldableBase.handleException(YieldableBase.java:162) at org.lealone.sql.executor.YieldableBase.run(YieldableBase.java:115) at org.lealone.db.session.ServerSession$YieldableCommand.run(ServerSession.java:1500) at org.lealone.server.Scheduler.executeNextStatement(Scheduler.java:247) at org.lealone.server.Scheduler.run(Scheduler.java:100) Caused by: java.lang.RuntimeException: not found: CONSTRAINT_8 at org.lealone.common.exceptions.DbException.getInternalError(DbException.java:250) at org.lealone.common.exceptions.DbException.throwInternalError(DbException.java:231) at org.lealone.db.schema.Schema.remove(Schema.java:258) at org.lealone.db.table.Table.removeChildrenAndResources(Table.java:528) at org.lealone.db.table.StandardTable.removeChildrenAndResources(StandardTable.java:496) at org.lealone.db.schema.Schema.remove(Schema.java:267) at org.lealone.sql.ddl.DropTable.executeDrop(DropTable.java:127) at org.lealone.sql.ddl.DropTable.update(DropTable.java:144) at org.lealone.sql.dml.RunScript.execute(RunScript.java:87) at org.lealone.sql.dml.RunScript.update(RunScript.java:66) at org.lealone.sql.executor.DefaultYieldableLocalUpdate.executeInternal(DefaultYieldableLocalUpdate.java:22) at org.lealone.sql.executor.YieldableBase.run(YieldableBase.java:109) ... 3 more

at org.lealone.net.TransferConnection.parseError(TransferConnection.java:66)
at org.lealone.net.TcpClientConnection.handleResponse(TcpClientConnection.java:101)
at org.lealone.net.TransferConnection.handle(TransferConnection.java:123)
at org.lealone.net.nio.NioEventLoop.read(NioEventLoop.java:208)
at org.lealone.net.nio.NioEventLoopClient.run(NioEventLoopClient.java:74)
at org.lealone.net.nio.NioEventLoopClient.lambda$0(NioEventLoopClient.java:46)
at java.base/java.lang.Thread.run(Thread.java:833)
codefollower commented 2 years ago

错误信息是执行drop table时发生的异常。

codefollower commented 2 years ago

constraint 相关的测试用例无法通过,说明新代码引入了新的 bug。