Here is one concrete example
CREATE ALIAS DECODE FOR "java.lang.Integer.decode";
CREATE TABLE FOO(COL1 VARCHAR(256), COL2 INT AS(DECODE(COL1)));
Then backup with drop option and try to restore.
Exception should be something like:
Exception in thread "main" org.h2.jdbc.JdbcSQLException: Cannot drop "PUBLIC.DECODE"
because "PUBLIC.FOO" depends on it; SQL statement:
DROP ALIAS IF EXISTS PUBLIC.DECODE [90107-154]
at org.h2.message.DbException.getJdbcSQLException(DbException.java:327)
at org.h2.message.DbException.get(DbException.java:167)
at org.h2.engine.Database.removeSchemaObject(Database.java:1542)
at
org.h2.command.ddl.DropFunctionAlias.update(DropFunctionAlias.java:40)
at org.h2.command.dml.RunScriptCommand.execute(RunScriptCommand.java:66)
at org.h2.command.dml.RunScriptCommand.update(RunScriptCommand.java:45)
at org.h2.command.CommandContainer.update(CommandContainer.java:69)
at org.h2.command.Command.executeUpdate(Command.java:212)
at org.h2.server.TcpServerThread.process(TcpServerThread.java:300)
at org.h2.server.TcpServerThread.run(TcpServerThread.java:137)
at java.lang.Thread.run(Thread.java:636)
- rami
On 05/10/2011 08:30 PM, Thomas Mueller wrote:
Hi,
> Well, the concrete problem is that I do a backup with script command using the drop option. And even with fairly simple databases when trying to restore the
database, restore operation exits because it is unable to execute those drop statements because of dependency issues.
With "concrete problem" I meant "an actual case where you get a problem". A
simple and complete test case.
> Hasn't this happened to others?
There were bugs in the past where wrong ordering of drop / create statements
caused problems.
> Would you like me to give a sample of such a dependency?
Yes, that would help a lot.
> One way to implement the drop option would be to come up with a function that would delete all db objects, no questions asked (this could be non-public but
might even be useful to a developer when developing and testing things).
This is supported: "drop all objects [ delete files ]". But it would be wrong to add that to each script automatically (dropping unrelated tables and other
objects).
Regards,
Thomas
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/h2-database?hl=en.