Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,958
    Thanks
    120
    Thanked 76 Times in 76 Posts

    Data truncated for column ...

    Only want to add 'date_observation_for_exact_id_galery' column to index.


    Code:
    ALTER TABLE `tezaver_place_date`
    	DROP PRIMARY KEY,
    	ADD PRIMARY KEY (`id_tezaver`, `cc2`, `place_id`, `date_observation`, `micro_location`, `id_galery`, `date_observation_for_exact_id_galery`) USING BTREE;
    
    /* SQL Error (1265): Data truncated for column 'date_observation_for_exact_id_galery' at row 3 */
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search

  • #2
    Senior Coder
    Join Date
    Dec 2005
    Location
    Slovenia
    Posts
    1,958
    Thanks
    120
    Thanked 76 Times in 76 Posts
    aparently adding index on 'date_observation_for_exact_id_galery' column, does not work if thee are null values !?


    Cant imagine why ewerything else work exept adding index.
    Found a flower or bug and don't know what it is ?
    agrozoo.net galery
    if you don't spot search button at once, there is search form:
    agrozoo.net galery search

  • #3
    New Coder
    Join Date
    Sep 2012
    Posts
    71
    Thanks
    0
    Thanked 8 Times in 8 Posts
    Hmm, that's a pretty large primary key.

    Do you need all those columns to have a primary key? If you were looking to query efficiently you might create some other indexes for that purpose.

    Also, as a primary key, you can only include NOT NULL defined columns.

    http://dev.mysql.com/doc/refman/5.1/...ate-table.html
    A PRIMARY KEY is a unique index where all key columns must be defined as NOT NULL. If they are not explicitly declared as NOT NULL, MySQL declares them so implicitly (and silently). A table can have only one PRIMARY KEY. The name of a PRIMARY KEY is always PRIMARY, which thus cannot be used as the name for any other kind of index.


  •  

    Posting Permissions

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