Vaibhav95g / h2database

Automatically exported from code.google.com/p/h2database
0 stars 0 forks source link

drop database syntax error #514

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Consider the following statements:
       create database TESTDB1;
       create database TESTDB2;
       drop database if exists TESTDB1;
       drop database if exists TESTDB2;

When I run the statement as above, I get Syntax error in SQL statement "drop 
database if exists TESTDB1". 

The Syntax error as follows:
      Error: General error: "java.lang.RuntimeException: Unexpected code path"; SQL statement:
      drop database if exists TESTDB1 [50000-169] (state=HY000,code=50000)

I am using H2 1.3.169

Original issue reported on code.google.com by lgrg...@gmail.com on 11 Oct 2013 at 2:19

GoogleCodeExporter commented 9 years ago
You have already created issue 513 with the same info, and I have rejected it.

When I run the statement, I get:

Syntax error in SQL statement "DROP DATABASE[*] IF EXISTS TESTDB1"

You need to provide a better description about what you do. Also, could you try 
with the latest version? You are using an older version: 1.3.169 (the version 
is in the error code, which is ...-169). And please provide the complete stack 
trace of the error.

Original comment by thomas.t...@gmail.com on 11 Oct 2013 at 3:16

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
stack trace of the error:
org.h2.jdbc.JdbcSQLException: General error: "java.lang.RuntimeException: 
Unexpected code path"; SQL statement:
DROP DATABASE IF EXISTS testDB1 [50000-169]
    at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
    at org.h2.message.DbException.get(DbException.java:158)
    at org.h2.message.DbException.convert(DbException.java:281)
    at org.h2.command.Command.executeUpdate(Command.java:240)
    at org.h2.server.TcpServerThread.process(TcpServerThread.java:344)
    at org.h2.server.TcpServerThread.run(TcpServerThread.java:155)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.lang.RuntimeException: Unexpected code path
    at org.h2.message.DbException.throwInternalError(DbException.java:228)
    at org.h2.message.DbException.throwInternalError(DbException.java:241)
    at org.h2.engine.Database.checkMetaFree(Database.java:1311)
    at org.h2.engine.Database.removeMeta(Database.java:845)
    at org.h2.schema.Schema.removeChildrenAndResources(Schema.java:145)
    at org.h2.engine.Database.removeDatabaseObject(Database.java:1602)
    at org.h2.command.ddl.DropSchema.update(DropSchema.java:48)
    at org.h2.command.CommandContainer.update(CommandContainer.java:75)
    at org.h2.command.Command.executeUpdate(Command.java:236)
    ... 3 more

Original comment by lgrg...@gmail.com on 14 Oct 2013 at 12:45

GoogleCodeExporter commented 9 years ago
Could you try with the latest version? Do you get the same error? When I run 
the statement, I get:

Syntax error in SQL statement "DROP DATABASE[*] IF EXISTS TESTDB1"

When I look at the source code of that version, the line 1311 of the Database 
class is not the method checkMetaFree, but within checkMetaFree. Is it possible 
that you have multiple versions of H2 in your classpath? See also:

https://code.google.com/p/h2database/source/browse/tags/version-1.3.169/h2/src/m
ain/org/h2/engine/Database.java

Original comment by thomas.t...@gmail.com on 14 Oct 2013 at 6:01

GoogleCodeExporter commented 9 years ago
Sorry, I wanted to write:

When I look at the source code of that version, the line 1311 of the Database 
class is not the method checkMetaFree, but within _getAllSchemaObjects_.

Original comment by thomas.t...@gmail.com on 14 Oct 2013 at 6:02