Hi,
I use h2 as embedded database for running testcases in my application. When
I tried upgrading from 1.4.177 to the current stable release 1.4.195, I get
an syntactical error when running the testcases.
The h2-1.4.xxx.jar is in my CLASSPATH. Testcases start with building up an
empty database from scratch. The tables, keys and constraints are loaded
into the database from a file (see tailored file in attachment).
The problem is the second CONSTRAINT, that I need to add. When executing
the statements in the attached file on the h2 console, I get the following
error:
ALTER TABLE `changehistorycomment` ADD CONSTRAINT
`fk_{D84AC7C2-453F-4894-A87C-47081E2D1954}` FOREIGN KEY (`scid`,
`changehistoryid`) REFERENCES `changehistory` (`scid`, `changehistoryid`)
ON DELETE CASCADE ON UPDATE CASCADE;
*Syntax Fehler in SQL Befehl "ALTER TABLE `changehistorycomment` ADD
CONSTRAINT `fk_{D84AC7C2-453F-4894-A87C-47081E2D1954}` FOREIGN KEY (`scid`,
`changehistoryid`) REFERENCES `changehistory` (`scid`, `changehistoryid`)
ON DELETE CASCADE ON UPDATE CASCAD[*]E"Syntax error in SQL statement "ALTER
TABLE `changehistorycomment` ADD CONSTRAINT
`fk_{D84AC7C2-453F-4894-A87C-47081E2D1954}` FOREIGN KEY (`scid`,
`changehistoryid`) REFERENCES `changehistory` (`scid`, `changehistoryid`)
ON DELETE CASCADE ON UPDATE CASCAD[*]E" [42000-195]*
<http://localhost:8082/query.do?jsessionid=e2d9b525560428115722ef888d04ce3d#>
42000/42000 *(Hilfe)*
<http://h2database.com/javadoc/org/h2/api/ErrorCode.html#c42000>
Since I don't see any syntactical mistake, I tried to go back to version
1.4.177 and with the old one, everything works fine.
I tried some other versions too: 1.4.180 is the last stable version, that
has no problems. 1.4.181 is the first release, that encounters the
syntactical error. Reading the changelog of version 1.4.181 I didn't see
any feasible explanation.
Hope, somebody can help me.
--
You received this message because you are subscribed to the Google Groups "H2
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.
--
-- Tabellenstruktur für Tabelle `changehistory`
--
CREATE TABLE IF NOT EXISTS `changehistory` (
`changehistoryid` int(11) NOT NULL AUTO_INCREMENT,
`scid` int(11) NOT NULL,
`category` int(11) DEFAULT NULL,
`changetypeid` int(11) DEFAULT NULL,
`changedatetime` datetime DEFAULT NULL COMMENT 'Datum/Zeit der Änderung',
`username` varchar(50) DEFAULT NULL COMMENT 'Name des Nutzers',
`details` text COMMENT 'Namen, Kommentare, Änderungen',
PRIMARY KEY (`changehistoryid`,`scid`)
);
-- --------------------------------------------------------
--
-- Tabellenstruktur für Tabelle `changehistorycomment`
--
CREATE TABLE IF NOT EXISTS `changehistorycomment` (
`scid` int(11) NOT NULL COMMENT 'SzenarID',
`changehistoryid` int(11) NOT NULL COMMENT 'HistoryID',
`historycommentid` int(11) NOT NULL,
`scidhistorycomment` int(11) NOT NULL,
PRIMARY KEY (`scid`,`changehistoryid`,`historycommentid`,`scidhistorycomment`)
);
--
-- Tabellenstruktur für Tabelle `historycomment`
--
CREATE TABLE IF NOT EXISTS `historycomment` (
`historycommentid` int(11) NOT NULL AUTO_INCREMENT,
`scid` int(11) NOT NULL COMMENT 'SzenarID',
`remark` text COMMENT 'Kommentar / Bemerkung',
`username` varchar(50) DEFAULT NULL COMMENT 'Nutzername',
PRIMARY KEY (`historycommentid`,`scid`)
);
--
-- Constraints der Tabelle `changehistorycomment`
--
ALTER TABLE `changehistorycomment`
ADD CONSTRAINT `fk_changehistorycomment_historycomment1` FOREIGN KEY (`historycommentid`, `scidhistorycomment`) REFERENCES `historycomment` (`historycommentid`, `scid`) ON DELETE CASCADE ON UPDATE CASCADE,
ADD CONSTRAINT `fk_{D84AC7C2-453F-4894-A87C-47081E2D1954}` FOREIGN KEY (`scid`, `changehistoryid`) REFERENCES `changehistory` (`scid`, `changehistoryid`) ON DELETE CASCADE ON UPDATE CASCADE;