1

So I have been playing around with the poll module in Drupal8-beta14 and I just upgraded the site to RC1. I am trying to uninstall the poll module now but i get this error everytime

exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown      [error]
column 'base_table.id' in 'field list'' in
/srv/www/dtadev2/core/lib/Drupal/Core/Database/Statement.php:64

the only place i can find the string "base_table" in the poll module at all is in the @ContentEntityType annotation

 @ContentEntityType(
 *   id = "poll",
 *   label = @Translation("Poll"),
 *   handlers = {
 *     "access" = "\Drupal\poll\PollAccessControlHandler",
 *     "storage" = "Drupal\poll\PollStorage",
 *     "translation" = "Drupal\content_translation\ContentTranslationHandler",
 *     "list_builder" = "Drupal\poll\PollListBuilder",
 *     "view_builder" = "Drupal\poll\PollViewBuilder",
 *     "views_data" = "Drupal\poll\PollViewData",
 *     "form" = {
 *       "default" = "Drupal\poll\Form\PollForm",
 *       "edit" = "Drupal\poll\Form\PollForm",
 *       "delete" = "Drupal\poll\Form\PollDeleteForm",
 *       "delete_vote" = "Drupal\poll\Form\PollVoteDeleteForm",
 *       "delete_items" = "Drupal\poll\Form\PollItemsDeleteForm",
 *     }
 *   },
 *   links = {
 *     "canonical" = "/poll/{poll}",
 *     "edit-form" = "/poll/{poll}/edit",
 *     "delete-form" = "/poll/{poll}/delete"
 *   },
 *   base_table = "poll",
 *   data_table = "poll_field_data",
 *   admin_permission = "administer polls",
 *   field_ui_base_route = "poll.poll_list",
 *   translatable = TRUE,
 *   entity_keys = {
 *     "id" = "id",
 *     "label" = "question",
 *     "uuid" = "uuid",
 *       "category" = "category",
 *     "langcode" = "langcode"
 *   }
 * )

So all I can think of is that for some reason when uninstalling the module Drupal is supposed to use poll but is take base_table instead.

Is this something in RC1 or is there an easy syntax error I am missing?

edited to add the backtrace info

    exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column            [error]
'base_table.id' in 'field list'' in /srv/www/dtadev2/core/lib/Drupal/Core/Database/Statement.php:64
Stack trace:
#0 /srv/www/dtadev2/core/lib/Drupal/Core/Database/Statement.php(64): PDOStatement->execute(Array)
#1 /srv/www/dtadev2/core/lib/Drupal/Core/Database/Connection.php(615):
Drupal\Core\Database\Statement->execute(Array, Array)
#2 /srv/www/dtadev2/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php(73):
Drupal\Core\Database\Connection->query('SELECT base_tab...', Array, Array)
#3 /srv/www/dtadev2/core/lib/Drupal/Core/Database/Query/Select.php(481):
Drupal\Core\Database\Driver\mysql\Connection->query('SELECT base_tab...', Array, Array)
#4 /srv/www/dtadev2/core/lib/Drupal/Core/Entity/Query/Sql/Query.php(262):
Drupal\Core\Database\Query\Select->execute()
#5 /srv/www/dtadev2/core/lib/Drupal/Core/Entity/Query/Sql/Query.php(89):
Drupal\Core\Entity\Query\Sql\Query->result()
#6 /srv/www/dtadev2/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(74):
Drupal\Core\Entity\Query\Sql\Query->execute()
#7 /srv/www/dtadev2/core/lib/Drupal/Core/Entity/ContentUninstallValidator.php(47):
Drupal\Core\Entity\ContentEntityStorageBase->hasData()
#8 /srv/www/dtadev2/core/lib/Drupal/Core/Extension/ModuleInstaller.php(539):
Drupal\Core\Entity\ContentUninstallValidator->validate('poll')
#9 /srv/www/dtadev2/core/lib/Drupal/Core/Extension/ModuleInstaller.php(343):
Drupal\Core\Extension\ModuleInstaller->validateUninstall(Array)
#10 /srv/www/dtadev2/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(95):
Drupal\Core\Extension\ModuleInstaller->uninstall(Array, true)
#11 /home/ubuntu/.composer/vendor/drush/drush/commands/core/drupal/environment.inc(227):
Drupal\Core\ProxyClass\Extension\ModuleInstaller->uninstall(Array)
#12 /home/ubuntu/.composer/vendor/drush/drush/commands/core/drupal/pm_8.inc(80):
drush_module_uninstall(Array)
#13 /home/ubuntu/.composer/vendor/drush/drush/commands/pm/pm.drush.inc(1190): _drush_pm_uninstall(Array)
#14 [internal function]: drush_pm_uninstall('poll')
#15 /home/ubuntu/.composer/vendor/drush/drush/includes/command.inc(364):
call_user_func_array('drush_pm_uninst...', Array)
#16 /home/ubuntu/.composer/vendor/drush/drush/includes/command.inc(215): _drush_invoke_hooks(Array,
Array)
#17 [internal function]: drush_command('poll')
#18 /home/ubuntu/.composer/vendor/drush/drush/includes/command.inc(183):
call_user_func_array('drush_command', Array)
#19 /home/ubuntu/.composer/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(62): drush_dispatch(Array)
#20 /home/ubuntu/.composer/vendor/drush/drush/drush.php(70):
Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#21 /home/ubuntu/.composer/vendor/drush/drush/drush.php(11): drush_main()
#22 {main}

Next exception 'Drupal\Core\Database\DatabaseExceptionWrapper' with message 'SQLSTATE[42S22]: Column not
found: 1054 Unknown column 'base_table.id' in 'field list': SELECT base_table.id AS id, base_table.id AS
base_table_id
FROM
{poll} base_table
GROUP BY base_table.id
LIMIT 1 OFFSET 0; Array
(
)
' in /srv/www/dtadev2/core/lib/Drupal/Core/Database/Connection.php:676
Stack trace:
#0 /srv/www/dtadev2/core/lib/Drupal/Core/Database/Connection.php(640):
Drupal\Core\Database\Connection->handleQueryException(Object(PDOException), 'SELECT base_tab...', Array,
Array)
#1 /srv/www/dtadev2/core/lib/Drupal/Core/Database/Driver/mysql/Connection.php(73):
Drupal\Core\Database\Connection->query('SELECT base_tab...', Array, Array)
#2 /srv/www/dtadev2/core/lib/Drupal/Core/Database/Query/Select.php(481):
Drupal\Core\Database\Driver\mysql\Connection->query('SELECT base_tab...', Array, Array)
#3 /srv/www/dtadev2/core/lib/Drupal/Core/Entity/Query/Sql/Query.php(262):
Drupal\Core\Database\Query\Select->execute()
#4 /srv/www/dtadev2/core/lib/Drupal/Core/Entity/Query/Sql/Query.php(89):
Drupal\Core\Entity\Query\Sql\Query->result()
#5 /srv/www/dtadev2/core/lib/Drupal/Core/Entity/ContentEntityStorageBase.php(74):
Drupal\Core\Entity\Query\Sql\Query->execute()
#6 /srv/www/dtadev2/core/lib/Drupal/Core/Entity/ContentUninstallValidator.php(47):
Drupal\Core\Entity\ContentEntityStorageBase->hasData()
#7 /srv/www/dtadev2/core/lib/Drupal/Core/Extension/ModuleInstaller.php(539):
Drupal\Core\Entity\ContentUninstallValidator->validate('poll')
#8 /srv/www/dtadev2/core/lib/Drupal/Core/Extension/ModuleInstaller.php(343):
Drupal\Core\Extension\ModuleInstaller->validateUninstall(Array)
#9 /srv/www/dtadev2/core/lib/Drupal/Core/ProxyClass/Extension/ModuleInstaller.php(95):
Drupal\Core\Extension\ModuleInstaller->uninstall(Array, true)
#10 /home/ubuntu/.composer/vendor/drush/drush/commands/core/drupal/environment.inc(227):
Drupal\Core\ProxyClass\Extension\ModuleInstaller->uninstall(Array)
#11 /home/ubuntu/.composer/vendor/drush/drush/commands/core/drupal/pm_8.inc(80):
drush_module_uninstall(Array)
#12 /home/ubuntu/.composer/vendor/drush/drush/commands/pm/pm.drush.inc(1190): _drush_pm_uninstall(Array)
#13 [internal function]: drush_pm_uninstall('poll')
#14 /home/ubuntu/.composer/vendor/drush/drush/includes/command.inc(364):
call_user_func_array('drush_pm_uninst...', Array)
#15 /home/ubuntu/.composer/vendor/drush/drush/includes/command.inc(215): _drush_invoke_hooks(Array,
Array)
#16 [internal function]: drush_command('poll')
#17 /home/ubuntu/.composer/vendor/drush/drush/includes/command.inc(183):
call_user_func_array('drush_command', Array)
#18 /home/ubuntu/.composer/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(62): drush_dispatch(Array)
#19 /home/ubuntu/.composer/vendor/drush/drush/drush.php(70):
Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#20 /home/ubuntu/.composer/vendor/drush/drush/drush.php(11): drush_main()
#21 {main}

describe poll shows this

+-------+---------+------+-----+---------+-------+
| Field | Type    | Null | Key | Default | Extra |
+-------+---------+------+-----+---------+-------+
| pid   | int(11) | NO   | PRI | 0       |       |
+-------+---------+------+-----+---------+-------+
  • Enable verbose error reporting (if you can't access the UI anymore at all, see sites/example.settings.local.php). Then post the full error here. Also ,when exactly does this happen, on every request or on specific actions only? – Berdir Oct 21 '15 at 18:55
  • if i use drush to uninstall the module or i go to any page with involving the poll. so anyting like /admin/content/poll/ breaks it. I have added the entire error. I think this is what you are looking for? – BrandenB171 Oct 21 '15 at 18:59
  • Can you execute "describe poll;" with drush sql-cli or similar and post the output here ? The error happens as part of the content check, which wants to prevent that you uninstall the poll module if there is data left. But apparently your poll table is messed up and doesn't look like it should. – Berdir Oct 21 '15 at 19:08
  • describe poll resutls are posted. ill look into your other link posted. Thanks! – BrandenB171 Oct 21 '15 at 20:42
1

Whatever the exact reason is, this is another variant here:

Not being able to uninstall a module when storage is messed up.

You could start a patch for that by adding a try/catch around the hasData() call in ContentUninstallValidator and ignoring the problem. No table or messed up table likely also means no data ;)

There might be additional errors after that, where you need similar fixes.

0

Explanation

The error means that id column is missing in your base table (poll) and it happens during uninstall process where ContentUninstallValidator::validate (part of Entity) determines the reasons a module can not be uninstalled and it fails.

This issue is further explained in the following bug report:

ContentEntityStorage base has a hasData() method that checks if any entities exist at all. This method is called during the uninstall process of a module to warn the user that data will be lost if the module is uninstalled.

When a module has deployment issues and the entity storage table has not been created, the hasData() method will throw an exception, completely blocking the uninstall process. So basically you end up with a broken module, that you cannot uninstall.

This is the code which fails in validate():

if ($module == $entity_type->getProvider() && $entity_type instanceof ContentEntityTypeInterface && $this->entityManager->getStorage($entity_type->id())->hasData()) {
  $reasons[] = $this->t('There is content for the entity type: @entity_type', array('@entity_type' => $entity_type->getLabel()));
}

Workaround

One workaround is to recreate the missing field, truncate table and uninstall the module again, e.g.

drush sqlq 'ALTER TABLE poll ADD COLUMN id INT(11)'
drush sqlq 'TRUNCATE TABLE poll'
drush -y pm-uninstall poll

Warning! By truncating you're removing all the data in that table, so backup it before if required.

Source: SQL Error on redirect uninstall.


Solution

To fix this problem completely, please apply the patch attached in the below bug report:

-2

I guess you must change its data base engine from innodb to myisam Infact you must do this for all of your tables

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.