Whenever I run Drupal Reset to delete database tables, the PDOException below is raised:
PDOException: SQLSTATE[42P01]: Undefined table: ERROR 7: relation "block" does not exist LINE 3: block b ^: SELECT b.* FROM {block} b WHERE (b.theme = :db_condition_placeholder_0) AND (b.status = :db_condition_placeholder_1) ORDER BY b.region ASC, b.weight ASC, b.module ASC; Array ( [:db_condition_placeholder_0] => seven [:db_condition_placeholder_1] => 1 ) in _block_load_blocks() (line 749 of /.../modules/block/block.module).
I verified this error on a clean installation using Standard profile. I also tested on Minimal profile, but the error does not occur in this case. I am using Drupal 7.51 and PostgreSQL.
This happens because the query is executed after the table was deleted by Drupal Reset.
After the database tables are deleted, drupal_goto() is called from drupal_reset_admin_settings_submit() to issue a redirect to install.php script. Then, some hooks may be called, like hook_drupal_goto_alter() and hook_exit(). Implementations for this hooks may need the database tables. Thus, errors may be raised if they no longer exist.
Therefore, I suggest using a custom redirect function instead of drupal_goto(). I am going to send a patch for this.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | fix-exception-db-deleted-2816519-2.patch | 2.01 KB | dbiscalchin |
Comments
Comment #2
dbiscalchin commentedA patch to use an alternative function for redirection.
Comment #3
dbiscalchin commentedComment #5
liam morlandThanks for the patch!