Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2003
    Posts
    24

    Unanswered: Key name lengths

    It seems from the errors I was getting that key name length cannot be more than 18 characters.
    Are there any known workarounds for this?
    Thanks

  2. #2
    Join Date
    Aug 2003
    Posts
    24
    Ok, its beginning to look bleak.
    I ran across this in the online help reference ->
    Longest unqualified user-defined type, user-defined function, user-defined method, buffer pool, table space, database partition group, trigger, index, or index specification name: 18 characters

    That same page claims that:
    Adhering to the most restrictive case can help the programmer design application programs that are easily portable.
    I beg to differ. Its not portable when other DBs can handle longer names.

    So my question is this.
    Is it possible for DB2 to "auto" generate index names?
    I notice that some indicies use what looks like a autogenerated name, for example:
    SYSIBM.SQL030816185712590

    Thanks for any insight you may provide...
    Last edited by trini0; 08-19-03 at 22:39.

  3. #3
    Join Date
    Aug 2003
    Posts
    24
    Well after a bit of reading, it seems like it only creates those names if the index is unique.
    So Im modifiying the question.
    Is is possible to auto generate names for duplicate indices?

    Currently, Im creating the index names by incrementing a numerical value after "idx_"n (done via php)
    And the code is somewhat modular, so Im trying to avoid, index name clashing in future code that needs to create new indices.
    Hope you understand.

  4. #4
    Join Date
    Aug 2001
    Location
    UK
    Posts
    4,650
    I'm not sure whether db2 creates system generated indexes for uniqe ones only ....

    I'll put it more generically .... Whenever db2 requires an index for enforcing a constraint and the index does not exist, it creates one ...
    For example, to enforce a primary key constraint, unique index is required ... So the user has not created one, db2 creates an unique index and enforces the constraint(Earlier, on os390 v5 it used to be different ... Unless you define a unique index, you cannot define a primary key ... not sure how the recent versions are) ... The other example is a unique check constraint ...

    I'm surprised that you want system generated names for all indexes (or is it indices ;-) ) .... Any site I go, I recommend creating indexes explicitly so that we can name the index ... The maintanence becomes easy .... I even had to write a script once to delete all system generated indexes of the primary key and then redefine the indexes before defining the primary key ...

    Cheers

    sathyaram
    Originally posted by trini0
    Well after a bit of reading, it seems like it only creates those names if the index is unique.
    So Im modifiying the question.
    Is is possible to auto generate names for duplicate indices?

    Currently, Im creating the index names by incrementing a numerical value after "idx_"n (done via php)
    And the code is somewhat modular, so Im trying to avoid, index name clashing in future code that needs to create new indices.
    Hope you understand.
    Visit the new-look IDUG Website , register to gain access to the excellent content.

  5. #5
    Join Date
    Aug 2003
    Posts
    24
    Well the php code Im creating currently can use other DBs that can handle index key lengths of more than 18 characteres.
    I agree with you about creating indices explicitly.
    But the nature of the program, is that other people can add code to it, and since DB2 cannot handle "same name" indicies, or indicies of lengths greater than 18, Im trying to figure out a way so when time comes for others to add code, that index names don't clash.
    But Ill see what else I can think of.
    Thanks for your time...

    Originally posted by sathyaram_s
    I'm surprised that you want system generated names for all indexes (or is it indices ;-) ) .... Any site I go, I recommend creating indexes explicitly so that we can name the index ... The maintanence becomes easy .... I even had to write a script once to delete all system generated indexes of the primary key and then redefine the indexes before defining the primary key ...

    Cheers

    sathyaram

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •