Uploaded image for project: 'CiviCRM'
  1. CiviCRM
  2. CRM-19295

Import wizard doesn't validate data lengths: data too long for column

    Details

    • Type: Bug
    • Status: Open
    • Priority: Trivial
    • Resolution: Unresolved
    • Affects Version/s: 4.7.10
    • Fix Version/s: None
    • Component/s: None
    • Labels:
      None
    • Versioning Impact:
      Patch (backwards-compatible bug fixes)
    • Documentation Required?:
      None
    • Funding Source:
      Needs Funding

      Description

      A fatal error is generated when trying to import csv which has data that is longer than the mysql column max length. No import errors are generated by the wizard, which doesn't seem to be validating the data length. For instance, a first name field that is too long will pass the validation step and then fail when it comes to actually import.

      [nativecode=1406 ** Data too long for column 'sort_name' at row 1] [to_string] => [db_error: message="DB Error: unknown error" code=-1 mode=callback callback=CRM_Core_Error::handle prefix="" info="INSERT INTO civicrm_contact (contact_type , contact_sub_type , do_not_email , do_not_phone , do_not_mail , do_not_sms , do_not_trade , is_opt_out , sort_name , display_name , preferred_communication_method , preferred_language , hash , first_name , last_name , email_greeting_id , postal_greeting_id , addressee_id ) VALUES ('Individual' , NULL , 0 , 0 , 0 , 0 , 0 , 0 , 'contact, j asodifjsadoifj aosidjf aspoidjf asodifjsa jasodfij asodifj asoi jfasd ojasdofijasfo jasdof jasdfoijasdfoj asodf jasodfj aosdfi jasodf jasdo jasdfo jasdof j' , 'j asodifjsadoifj aosidjf aspoidjf asodifjsa jasodfij asodifj asoi jfasd ojasdofijasfo jasdof jasdfoijasdfoj asodf jasodfj aosdfi jasodf jasdo jasdfo jasdof j contact' , '' , 'en_GB' , '13fe0395a8f5c720b129a480fe778d32' , 'j asodifjsadoifj aosidjf aspoidjf asodifjsa jasodfij asodifj asoi jfasd ojasdofijasfo jasdof jasdfoijasdfoj asodf jasodfj aosdfi jasodf jasdo jasdfo jasdof j' , 'contact' , 1 , 1 , 1 ) [nativecode=1406 ** Data too long for column 'sort_name' at row 1]"] )

      Tested on CiviCRM drupal demo site, 4.7.12 and on our drupal 4.7.10

      I have attached an example csv that causes the error.

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              dotsam Samuel Haskell
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: