#859 create table script generates incorrect foreign key stmt

3.1
closed
5
2011-08-19
2010-04-12
No

SquirrelSQL v3.1, Java 1.6 on linux

Database: DB2 9.1. on linux, JDBC driver is db2jcc.jar version 3.52.99

I have two tables:

CREATE TABLE "TEST"."AUDITEVENTTYPE"
(
EVENTID smallint PRIMARY KEY NOT NULL,
EVENTDESCRIPTION varchar(100) NOT NULL
)
;
CREATE TABLE "TEST"."AUDITLOG"
(
ID bigint PRIMARY KEY NOT NULL,
EVENTTYPEID smallint NOT NULL,
ADDED timestamp NOT NULL,
USERNAME varchar(50) NOT NULL,
DETAILS varchar(256) NOT NULL
)

AUDITEVENTTYPE contains a fixed list of possible event types.

AUDITLOG.EVENTTYPEID references AUDITEVENTTYPE.EVENTID

When generating alter statements for foreign key constraints, the statement references AUDITEVENTTYPE.EVENTTYPEID which does not exist:

ALTER TABLE "TEST"."AUDITLOG"
ADD CONSTRAINT FK_AUDITLOG
FOREIGN KEY (EVENTTYPEID)
REFERENCES "TEST"."AUDITEVENTTYPE"(EVENTTYPEID);

Discussion

  • Just run the same script against an Oracle database, same problem. This bug is not database-specific.

     
  • Gerd Wagner
    Gerd Wagner
    2011-08-19

    • status: open --> closed
     
  • Gerd Wagner
    Gerd Wagner
    2011-08-19

    Fixed in our SVN repository, will be available in future snapshots and version