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.

Comments

dbiscalchin created an issue. See original summary.

dbiscalchin’s picture

StatusFileSize
new2.01 KB

A patch to use an alternative function for redirection.

dbiscalchin’s picture

Status: Active » Needs review

liam morland’s picture

Status: Needs review » Fixed

Thanks for the patch!

Status: Fixed » Closed (fixed)

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