What steps will reproduce the problem?
1. With an other tool, create a database with the following tables:
CREATE TABLE a(x int);
CREATE TABLE b(y int references a);
Note that I simply wrote "references a", not "references a(x)".
2. Open the database in the SQLJet database browser
What is the expected output? What do you see instead?
org.antlr.runtime.tree.RewriteEarlyExitException
at org.tmatesoft.sqljet.core.internal.lang.SqlParser.fk_clause(SqlParser.java:15409)
at org.tmatesoft.sqljet.core.internal.lang.SqlParser.column_constraint(SqlParser.java:13186)
at org.tmatesoft.sqljet.core.internal.lang.SqlParser.column_def(SqlParser.java:12878)
at org.tmatesoft.sqljet.core.internal.lang.SqlParser.create_table_stmt(SqlParser.java:12545)
at org.tmatesoft.sqljet.core.internal.lang.SqlParser.schema_create_table_stmt(SqlParser.java:1405)
at org.tmatesoft.sqljet.core.internal.schema.SqlJetSchema.parseTable(SqlJetSchema.java:410)
at org.tmatesoft.sqljet.core.internal.schema.SqlJetSchema.readShema(SqlJetSchema.java:315)
at org.tmatesoft.sqljet.core.internal.schema.SqlJetSchema.init(SqlJetSchema.java:168)
at org.tmatesoft.sqljet.core.internal.schema.SqlJetSchema.<init>(SqlJetSchema.java:154)
at org.tmatesoft.sqljet.core.table.engine.SqlJetEngine$2.runSynchronized(SqlJetEngine.java:282)
at org.tmatesoft.sqljet.core.table.engine.SqlJetEngine.runSynchronized(SqlJetEngine.java:217)
at org.tmatesoft.sqljet.core.table.engine.SqlJetEngine.readSchema(SqlJetEngine.java:276)
at org.tmatesoft.sqljet.core.table.engine.SqlJetEngine.refreshSchema(SqlJetEngine.java:310)
at org.tmatesoft.sqljet.core.table.engine.SqlJetEngine.getSchemaInternal(SqlJetEngine.java:316)
at org.tmatesoft.sqljet.core.table.SqlJetDb.getSchema(SqlJetDb.java:183)
at org.tmatesoft.sqljet.browser.core.schema.SchemaComponent.open(SchemaComponent.java:51)
at org.tmatesoft.sqljet.browser.core.BrowserComponentManager.stateChanged(BrowserComponentManager.java:220)
at org.tmatesoft.sqljet.browser.core.BrowserComponentManager.open(BrowserComponentManager.java:195)
at org.tmatesoft.sqljet.browser.core.actions.OpenAction.actionPerformed(OpenAction.java:68)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.menuDragMouseReleased(Unknown Source)
at javax.swing.JMenuItem.fireMenuDragMouseReleased(Unknown Source)
at javax.swing.JMenuItem.processMenuDragMouseEvent(Unknown Source)
at javax.swing.JMenuItem.processMouseEvent(Unknown Source)
at javax.swing.MenuSelectionManager.processMouseEvent(Unknown Source)
at javax.swing.plaf.basic.BasicPopupMenuUI$MouseGrabber.eventDispatched(Unknown Source)
at java.awt.Toolkit$SelectiveAWTEventListener.eventDispatched(Unknown Source)
at java.awt.Toolkit$ToolkitEventMulticaster.eventDispatched(Unknown Source)
at java.awt.Toolkit.notifyAWTEventListeners(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$400(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
What version of the product are you using? On what operating system?
Version 1.1.10 (also tested with nightly builds)
Please provide any additional information below.
The bug is in the parser, on the rule "fk_clause" : the syntax accepts the
eventuality that there is no columns declaration (code between parenthesis is
followed by "?") while the rewriting rule does not: if I replace (COLUMNS
$column_names+) with (COLUMNS $column_names*) it seems to work, but I did not
test if it has other effects.
Note that foreighn clause without columns is explicitly accepted by SQLite's
syntax :
https://www.sqlite.org/syntax/foreign-key-clause.html
Original issue reported on code.google.com by t_cordon...@yahoo.fr on 9 Feb 2015 at 1:55
Original issue reported on code.google.com by
t_cordon...@yahoo.fr
on 9 Feb 2015 at 1:55Attachments: