#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2012
    Posts
    24
    Rep Power
    0

    Error on Update "unique index"


    Please advise best way to correct this.

    Complete message is EIB_ISCError with message 'ISC ERROR CODE:335544349.

    ISC ERROR MESSAGE: attempt to store duplicate value (visible to active transactions) in unique index "IDX_USERNAME"
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2012
    Posts
    24
    Rep Power
    0

    Unique Index Error in Delphi not IB_SQL


    Opened the table in IB_SQL, and the desired update worked fine. Also noticed in Delphi that the identity of the client user seems to matter. A user can update her own data, but cannot update data of others. Some records are not subject to this error, and others are. Does this tell us anything about the source of the error?

    Originally Posted by jwcane
    Please advise best way to correct this.

    Complete message is EIB_ISCError with message 'ISC ERROR CODE:335544349.

    ISC ERROR MESSAGE: attempt to store duplicate value (visible to active transactions) in unique index "IDX_USERNAME"
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2006
    Posts
    205
    Rep Power
    15
    Originally Posted by jwcane
    Opened the table in IB_SQL, and the desired update worked fine. Also noticed in Delphi that the identity of the client user seems to matter. A user can update her own data, but cannot update data of others. Some records are not subject to this error, and others are. Does this tell us anything about the source of the error?

    Does this tell us anything about the source of the error?
    It says that you have a UNIQUE INDEX defined in IDX_USERNAME (probably on the USERNAME field) and you entered a duplicate username. Take care of case sensitivity. Firebird is case sensitive so you might want to change all usernames to the same case first (upper or lower). I'd do that in a trigger like this:

    CREATE OR ALTER TRIGGER users_biu0 FOR users
    ACTIVE BEFORE INSERT OR UPDATE POSITION 1
    AS
    BEGIN
    NEW.username = LOWER(NEW.username);
    ...

    END


    be aware to change "users" to your table name...


    I saw some other similar posts from you in the forum...i'd advise to read more documentation on Firebird SQL. You'll find a lot of info on the official firebird page firebirdsql.org

IMN logo majestic logo threadwatch logo seochat tools logo