2

I am trying to remove an object CATEGORY. All keys in this particular object are <null>. Nor is the ID of this object part of any foreign key in another object. Still I'm getting a violation. I have no idea what 'CCNTCTGSLCTDCTGRSD' might be.

I have no idea how I can investigate this any further, I have selected the object (SELECT * FROM CATEGORY WHERE ID = 1) and I have run a query on any other objects with possible foreign keys (SELECT * FROM xxx WHERE CATEGORY_ID = 1).

Error code -1, SQL state 23503: DELETE on table 'CATEGORY' caused a violation of foreign key constraint 'CCNTCTGSLCTDCTGRSD' for key (1).  The statement has been rolled back.

This message is all I get. Any suggestions?

Menno
  • 12,175
  • 14
  • 56
  • 88

1 Answers1

0

Try connecting to the database with the 'ij' tool and use the DESCRIBE and SHOW INDEXES commands to get a better feel for the DDL and constraints on the table.

You can also select from SYS.SYSCONSTRAINTS to list all the constraints that are present in the database schema.

Some references:

http://db.apache.org/derby/docs/10.9/tools/rtoolsijcomrefdescribe.html

http://db.apache.org/derby/docs/10.9/tools/rtoolsijcomrefshow.html

http://db.apache.org/derby/docs/10.9/ref/rrefsistabs23241.html

Bryan Pendleton
  • 16,128
  • 3
  • 32
  • 56
  • My hero! `SELECT t.TABLENAME FROM SYS.SYSCONSTRAINTS c, SYS.SYSTABLES t WHERE c.TABLEID = t.TABLEID AND c.CONSTRAINTNAME = 'CCNTCTGSLCTDCTGRSD'` using `ij` gave me a clue as to what classes are involved. I'm convinced I will be able to solve my problem. – Menno Apr 14 '13 at 09:45