DB constraint violation

Version 1

    Subject: RE: DB constraint violation
    Replied by: Thomas Ellis on 05-12-2013 01:01:29 PM
    Hi Stephan,
    you can start with the data dictionary.  Check the 'enduser' table and there will be a list of all fields and any constraints on a field.  The error message you received is not super helpful though.  Is what you posted the complete message?  looks like there should be something after the 'Parameters:' section.......unless for some reason your call to updateUser is not supplying any parameters...which might explain the failure.  Can you provide which parameters you are supplying in the updateUser call?
    This document was generated from CDN thread

    Created by: Stephan Steiner on 05-12-2013 12:41:34 PM

    an updateUser gets me

    18:28:46.176 Couldn't update user with id sutebrch on cluster BBMCH (1). Reason: Description: Unique constraint (informix.mx_240_1736_1737_1738) violated., Error Code: DBL error , Error Message: , Request: updateUser, Parameters: 

    That's not a very user or developer friendly error code.. shouldn't the constraints at least be named in a way to that we get an idea about what is wrong (e.g. the contraint name should reference the table and property that should be unique... ), otherwise, you need to turn on debug level traces throughout the system to see what's going on which isn't something you just can do at any given time.

    Looking at the XML I see nothing suspicious - I'm now trying to add diff statements to my code to see what's changing then trying to replicate in ccmadmin (bit I expect the same error once I figure out which property to change.. I've seen those kind of errors before and it was basically guesswork to figure out what could be going wrong).

    I'd recomment that this be improved in the future in order to speed up troubleshooting procedures. And if anybody knows what the constrain actually means, it would be appreciated. Is there maybe a hidden list somewhere that explains all the constraints?


    Subject: RE: DB constraint violation
    Replied by: David Staudt on 05-12-2013 02:01:32 PM
    It might be possible to puzzle out the exact table/column/constraint by looking at some of the IDS system tables (SYSCONSTRAINTS, SYSINDEXES, SYSTABLES, etc.)  I would assume the value 'informix.mx_240_1736_1737_1738' probably refers to a mutiple index constraint, e.g. 'table 240 must have unique values for indexes 1736, 1736, 1738'.  However, with some research and looking at my 9.1 system, these particular values don't seem to line up too well with tables/constraints/indexes relevant to 'updateUser'.  Perhaps with the exact UCM version and the full AXL log, it might be possible to work out which constraint is the problem, a general way to decode the constraint pointers in future.
    Agree it would be far nicer for the developer to present a more meaningful message, but as above it might be a significant amount of work to algorithmically decode the IDS internal error messages.

    IDS reference: http://publib.boulder.ibm.com/infocenter/idshelp/v10/index.jsp?topic=/com.ibm.sqlr.doc/sqlrmst03.htm