Problem/Motivation

When enabling flag_lists, it fails with `PDOException: SQLSTATE[42000]: Syntax error or access violation: 1171 All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead`. Must be specific to a mysql version or settings for it not to have been a problem yet? I'm using version `mysql Ver 14.14 Distrib 5.7.17, for Linux (x86_64)`.

Proposed resolution

Patch attached.

Remaining tasks

Needs review.

User interface changes

None.

API changes

None.

Data model changes

None.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kimberleycgm created an issue. See original summary.

kimberleycgm’s picture

kimberleycgm’s picture

Changing the schema of flag_lists_types to set the type field to not null allows the module to be installed, and it already has the default set so I don't think this will cause issues anywhere else?

kimberleycgm’s picture

Status: Active » Needs review
sl27257’s picture

Thanks!

Will look into it :)

BR

/Thomas

sl27257’s picture

Assigned: Unassigned » sl27257
FileSize
780 bytes

I have now added an update of an existing database as well.

patoshi’s picture

still getting the same error on the latest mar-2017 dev version:

http://prntscr.com/ggztvt

The following extensions will be enabled: flag_lists
Do you really want to continue? (y/n): y
PDOException: SQLSTATE[42000]: Syntax error or access violation: 1171 All parts of a PRIMARY KEY must be NOT NULL; if you need NULL in a key, use UNIQUE instead in /var/www/hotsite_d7/docroot/includes/database/database.inc:2227 [error]
Stack trace:
#0 /var/www/hotsite_d7/docroot/includes/database/database.inc(2227): PDOStatement->execute(Array)
#1 /var/www/hotsite_d7/docroot/includes/database/database.inc(697): DatabaseStatementBase->execute(Array, Array)
#2 /var/www/hotsite_d7/docroot/includes/database/schema.inc(667): DatabaseConnection->query('CREATE TABLE {f...')
#3 /var/www/hotsite_d7/docroot/includes/database/database.inc(2776): DatabaseSchema->createTable('flag_lists_type...', Array)
#4 /var/www/hotsite_d7/docroot/includes/common.inc(7114): db_create_table('flag_lists_type...', Array)
#5 /var/www/hotsite_d7/docroot/includes/module.inc(479): drupal_install_schema('flag_lists')
#6 /vendor/drush/drush/commands/core/drupal/environment_7.inc(143): module_enable(Array)
#7 /vendor/drush/drush/commands/pm/pm.drush.inc(1167): drush_module_enable(Array)
#8 /vendor/drush/drush/includes/command.inc(422): drush_pm_enable('flag_lists')
#9 /vendor/drush/drush/includes/command.inc(231): _drush_invoke_hooks(Array, Array)
#10 /vendor/drush/drush/includes/command.inc(199): drush_command('flag_lists')
#11 /vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67): drush_dispatch(Array)
#12 /vendor/drush/drush/includes/preflight.inc(66): Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#13 /vendor/drush/drush/drush.php(12): drush_main()
#14 {main}

  • sl27257 committed 9850f00 on 7.x-3.x authored by kimberleycgm
    Issue #2859609 by kimberleycgm, sl27257: 'Syntax error or access...
sl27257’s picture

Thanks for the reminder!

Pushed!

BR

/Thomas

sl27257’s picture

Status: Needs review » Fixed

Changing status

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

sl27257’s picture