Issue Details (XML | Word | Printable)

Key: NUCRDBMS-494
Type: Bug Bug
Status: Closed Closed
Resolution: Cannot Reproduce
Priority: Testcase Required Testcase Required
Assignee: Unassigned
Reporter: Mikhail Moussikhine
Votes: 0
Watchers: 0
Operations

If you were logged in you would be able to see more operations.
DataNucleus Store RDBMS

SchemaTool DELETE fails when datanucleus.mapping.Schema is specified

Created: 28/Jan/11 09:25 PM   Updated: 07/Mar/11 05:37 PM   Resolved: 24/Feb/11 05:31 PM
Component/s: SchemaTool
Affects Version/s: 2.2.2
Fix Version/s: None

Datastore: Apache Derby


 Description  « Hide
When database schema is explicitly defined using datanucleus.mapping.Schema, DELETE command of the SchemaTool fails, since the generated SQL ALTER statement does not include the schema prefix. Below is the relevant portion of the log.

DEBUG [2011-01-28 15:06:05,764] (Log4JLogger.java:58) DataNucleus.Connection - Setting transaction isolation read-committed to connection: jdbc:derby://localhost:1527/parley;create=true, UserName=admin, Apache Derby Network Client JDBC Driver
DEBUG [2011-01-28 15:06:05,766] (Log4JLogger.java:58) DataNucleus.Connection - Connection "jdbc:derby://localhost:1527/parley;create=true, UserName=admin, Apache Derby Network Client JDBC Driver" opened with isolation level "read-committed"
INFO [2011-01-28 15:06:05,773] (Log4JLogger.java:77) DataNucleus.Datastore.Schema - Dropping 1 foreign key(s) for table APP.NODE
DEBUG [2011-01-28 15:06:05,773] (Log4JLogger.java:58) DataNucleus.Datastore.Schema - ALTER TABLE NODE DROP CONSTRAINT NODE_FK1
ERROR [2011-01-28 15:06:05,785] (Log4JLogger.java:115) DataNucleus.Datastore.Schema - An exception was thrown while dropping class(es) : 'ALTER TABLE' cannot be performed on 'NODE' because it does not exist.
java.sql.SQLSyntaxErrorException: 'ALTER TABLE' cannot be performed on 'NODE' because it does not exist.
at org.apache.derby.client.am.SQLExceptionFactory40.getSQLException(Unknown Source)
at org.apache.derby.client.am.SqlException.getSQLException(Unknown Source)
at org.apache.derby.client.am.Statement.execute(Unknown Source)
at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)
at org.apache.commons.dbcp.DelegatingStatement.execute(DelegatingStatement.java:264)
at org.datanucleus.store.rdbms.table.TableImpl.dropConstraints(TableImpl.java:855)
at org.datanucleus.store.rdbms.DeleteTablesSchemaTransaction.run(DeleteTablesSchemaTransaction.java:106)
at org.datanucleus.store.rdbms.AbstractSchemaTransaction.execute(AbstractSchemaTransaction.java:113)
at org.datanucleus.store.rdbms.RDBMSStoreManager.removeAllClasses(RDBMSStoreManager.java:928)
at org.datanucleus.store.rdbms.SchemaTool.deleteSchema(SchemaTool.java:1034)
at org.datanucleus.store.rdbms.SchemaTool.main(SchemaTool.java:344)

Notice:

Dropping 1 foreign key(s) for table APP.NODE

And following:

ALTER TABLE NODE DROP CONSTRAINT NODE_FK1

It is "ALTER TABLE NODE" instead of "ALTER TABLE APP.NODE".

P.S. I am well aware that a test case is required. I will provide it as soon as I can.

Sort Order: Ascending order - Click to sort in descending order
Andy Jefferson added a comment - 24/Feb/11 05:31 PM
Maybe works in current code, but maybe not. Left as an exercise to the user since no testcase was provided.