please help me
When I want to save any changes in my modules or configuration or contents and the other thing, this message has shown :

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'dspcore-db.cache_field' doesn't exist: DELETE FROM {cache_field} WHERE (cid LIKE :db_condition_placeholder_0 ESCAPE '\\') ; Array ( [:db_condition_placeholder_0] => field\_info\_types:% ) in cache_clear_all() (in 165 line D:\xampp\htdocs\dspcore\includes\cache.inc).

I can do nothing , please some one help me..

Comments

spicon74’s picture

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'drupalbet.cache_field' doesn't exist: DELETE FROM {cache_field} WHERE (cid = :db_condition_placeholder_0) ; Array ( [:db_condition_placeholder_0] => field:node:23 ) in cache_clear_all() (line 165 of C:\drupal\includes\cache.inc).

I have the same error. Please help.

VM’s picture

exact version of Drupal in use?
have you manually inspected the database to ensure the field is/isn't there?

dspcore’s picture

I'm using drupal 7.26
I checked my database in phpmyadmin > left sidebar databases>my database, and after expanding the db I tried to expand the cache_field table but there was not that, so I run that sql code that I said.

dspcore’s picture

I fix this error by dropping cache_field table in database and create it again,
for this you can log in to your phpmyadmin and click on your database>click sql tab> run this code : drop TABLE `cache_field`
then click go.
now run this code ;
CREATE TABLE IF NOT EXISTS `cache_field` (
`cid` varchar(255) NOT NULL DEFAULT '' COMMENT 'Primary Key: Unique cache ID.',
`data` longblob COMMENT 'A collection of data to cache.',
`expire` int(11) NOT NULL DEFAULT '0' COMMENT 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.',
`created` int(11) NOT NULL DEFAULT '0' COMMENT 'A Unix timestamp indicating when the cache entry was created.',
`serialized` smallint(6) NOT NULL DEFAULT '0' COMMENT 'A flag to indicate whether content is serialized (1) or not (0).',
PRIMARY KEY (`cid`),
KEY `expire` (`expire`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Generic cache table for caching things not separated out...';

I hope it would be good for you.

ftrebuchet’s picture

I just follow your post and all is ok now.
If anyone knows why this error occurs...

Thanks again.

Fred

dspcore’s picture

Your wellcome
:)

ryantollefson’s picture

Thanks.

MariskaTh’s picture

I'm trying to install Drupal 7 now for a long time, bit each time I end up with this same error. I hope that this solution will help me out too. The only problem is that I do not understand it. My database has no cache_field table. Where should I put the code that you have written above?
Thanks.

VM’s picture

if it isn't there it should be. the installer should be creating it. What version are you installing?

Codeblind’s picture

If your cache_field table is corrupt, you should be able to clear it by running update.php or cc all from drush. If you want to empty the table contents without deleting and rebuilding the schema, you can delete from cache_table or truncate cache_table.

brylie’s picture

Wow, this works great. I missed the drop table statement the first time, so I am re-posting with code blocks:

drop TABLE `cache_field`;
CREATE TABLE IF NOT EXISTS `cache_field` (
    `cid` varchar(255) NOT NULL DEFAULT '' COMMENT 'Primary Key: Unique cache ID.',
    `data` longblob COMMENT 'A collection of data to cache.',
    `expire` int(11) NOT NULL DEFAULT '0' COMMENT 'A Unix timestamp indicating when the cache entry should expire, or 0 for never.',
    `created` int(11) NOT NULL DEFAULT '0' COMMENT 'A Unix timestamp indicating when the cache entry was created.',
    `serialized` smallint(6) NOT NULL DEFAULT '0' COMMENT 'A flag to indicate whether content is serialized (1) or not (0).',
    PRIMARY KEY (`cid`),
    KEY `expire` (`expire`)
    ) 
    ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='Generic cache table for caching things not separated out...';
gparsloe’s picture

I'm running Acquia Dev Desktop 2 (Drupal 7.34). After running the create table code block in the PHPMyAdmin sql box, everything worked great.

Note: The drop table line didn't do anything in my case, though it did confirm that the table didn't exist.

mukiibi’s picture

Thanks for this solution. You saved me from dropping the entire table

TravisWright’s picture

Had the same issue and the solution by dspcore worked perfectly!

I am a complete newbie to Drupal (with high hopes) and the forums proved helpful once again.

KarenPietsch’s picture

This worked for me as well. Thank you so very much.

KarenPietsch’s picture

This worked for me as well. I can't thank you enough. I actually posted this under the wrong entry but it was based on your input here which I saw first. So, thank you, thank you, thank you!!!!

borrico1965’s picture

Thank you for this solution. In my case it was 'cache_update' table. It solved my problem!

opgobee’s picture

I also had error PDOException: SQLSTATE[42S02]: Base table or view not found: 1932 'cache_field'

The problem arose on a fresh Drupal 7.59 after changing the title of the 'body' field in the first custom content type I had made.

When I looked up the table 'cache_field', the table did show up in phpmyadmin in the table list at the left, but when clicked, an error message said it didn't exist. Dropping the table with dspcore's SQL line made the table 'cache_field' indeed disappear from the table listing at the left, creating it again with dspcore's SQL neatly re-created the table and most importantly made the error disappear. Thank you!

bawoor’s picture

ꦱꦠꦽꦶꦪ

domygle’s picture

I have the same error, D7.3, fresh, clean install. I reinstalled to get rid of the error.
I cant change anything in my local site, whitout getting this:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'bitnami_drupal7.cache_field' doesn't exist: DELETE FROM {cache_field} WHERE (cid LIKE :db_condition_placeholder_0 ESCAPE '\\') ; Array ( [:db_condition_placeholder_0] => field\_info\_types:% ) in cache_clear_all() (line 165 of C:\xampp\apps\drupal\htdocs\includes\cache.inc).

Then tried to create the missing table, but then got this error:

"#1813 - Tablespace for table '`bitnami_drupal7`.`cache_field`' exists. Please DISCARD the tablespace before IMPORT.

Going through the tablespace shows no such field.

I think I read somewhere to make the table in a copy of the db, so I went on and created the (also missing) table in the old db (made with D7.29).
That went fine!
Then tried to copy that table into the new db, but I cant seem to do that.
Not an expert in MySql, can someone please help?

domygle’s picture

...now solved!

After 3 reinstalls I gave up on this, found that its something to do with the Xampp.

Installed fresh with another stack, everything works fine now, the table cache_field is now present.
The new stack I use is Acquia Dev Desktop - if anyone cares!

Anonymous’s picture

im working in a mac with MAMP.
all my other sites work fine, but just one have that problem...
i also reisntall the site 3 times..

mathieso’s picture

Checked the MySQL error logs after MySQL 1146 (table dinna exist, cap'n, she'll nae install). InnoDB (one of MySQL's DB engines) complained that it couldn't find an .idb file. That's part of the data dictionary.

If you drop the tables in a DB after a failure, that might not kill all the data dictionary files (though not sure). When I erased the DB entirely, and then created a new one with the same name, Drupal installed.

Kieran

sihanat’s picture

I solved my problem by installing scheme module

Anonymous’s picture

josues-MacBook-Pro:borkis josue$ drush en schema -y
The following extensions will be enabled: schema
Do you really want to continue? (y/n): y
WD php: PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'borkis.cache_variable' doesn't exist: TRUNCATE {cache_variable} ; Array [error]
(
)
in cache_clear_all() (line 167 of /Applications/MAMP/htdocs/borkis/includes/cache.inc).
Cannot modify header information - headers already sent by (output started at /usr/local/share/drush/drush/includes/output.inc:38) bootstrap.inc:1257 [warning]
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'borkis.cache_variable' doesn't exist: TRUNCATE {cache_variable} ; Array
(
)
in cache_clear_all() (line 167 of /Applications/MAMP/htdocs/borkis/includes/cache.inc).
Drush command terminated abnormally due to an unrecoverable error. [error]
josues-MacBook-Pro:borkis josue$

leisurman’s picture

I am missing 2 sql tables that a fresh drupal 7 site has
ctools_custom_content
ctools_object_cache

VM’s picture

Those aren't core tables. They are from the ctools module.

vunda’s picture

I have a new error: I need help, please....

PDOException: SQLSTATE[22P02]: Invalid text representation: 7 ERROR: invalid input syntax for integer: "468 active-trail" LINE 6: WHERE (mlid = '468 active-trail') ) subquery ^: SELECT COUNT(*) AS expression FROM (SELECT 1 AS expression FROM {menu_target_links} m WHERE (mlid = :db_condition_placeholder_0) ) subquery; Array ( [:db_condition_placeholder_0] => 468 active-trail ) in _menu_target_retarget_link() (line 119 of /local/sites/website/dfolder/sites/all/modules/menu_target/menu_target.module).

elvisronn’s picture

It worked for me. Thanks!

opgobee’s picture

I reported 7 months ago that dspcore's solution worked. Unfortunately the error returned repeatedly at unforeseen moments. An expert Drupal developer suggested that the problem might be in running php7.1 with incompatible contrib modules. I downgraded to XAMPP with php 5.6. The problems disappeared. After 1st of jan my provider stopped supporting php 5.6 as it was not supported anymore. Fair enough. I upgraded to XAMPP 7.28 with php 7.2.8. and thereafter to XAMPP 7.3.3. with php 7.3.3. Last weeks the problems restarted again. Unfortunately simply getting rid of the problem table didn't help often. I have needed to completely start with a fresh XAMPP stack now 3 times in the last 10 days. When the problem occurs you lose several hours rebuilding everything again. It makes me being anxious to clear the cache. And today it occurred twice at simply adding a field to a content-type. This starts getting unworkable. My observations so far on this:

  • Running Drupal 7.65 on XAMPP 7.3.3 with php 7.3.3, MariaDB 10.1.38. On Windows 10, 64 bits.
  • Problem: after hours of working problem free, unexpectedly at a 'Clear cache' or adding a field in a content-type or any operation in the GUI (I cannot find a specific reason): BANG. 'PDO exception: SQLSTATE[42S02]: Base table or view not found 1932. Table '....' doesn't exist in engine'. Or: 'PDOException: SQLSTATE[HY000]: General error: 1030 Got error -1 from storage engine: TRUNCATE'
  • the error is always in line 173 of function cache_clear_all() in htdocs/MYSITENAME/includes/cache.inc

  • Always a cache table is affected. I recall the occurrences with 'cache', 'cache_field' and 'cache_token'

  • The cache table shows being 'in use' but cannot be dropped. Or the table is removed, but when one tries to recreate it with a MySQL Create table, it says it already exists.

  • If getting rid of the table with dspcore's trick doesn't work, dropping the database and reimporting it also doesn't work. I got variant errors, such as: 1. Mysql crashing. 2. Error after having run 90% of the SQL import stating that there was no permission. 3. An error stating: This table has 8 indexes but it should have 8 indexes.

  • Finally fell back to the only solution that worked: starting with a complete fresh XAMPP.

  • Related issues appear to be: https://www.drupal.org/project/drupal/issues/2229013 and https://www.drupal.org/project/drupal/issues/2684359 that regard Drupal 8

  • Combining the info from this thread and these other two issues, I consider the following possible clues, but I am not very knowledgable about MySQL:

  • It is related to something with XAMPP

  • Or it is related to 'TRUNCATE'  and a MySQL update as reported in issue 2229013 above.

Does anyone else experience such issues?

Is there any less invasive way to solve it?

Can I in some way during developing disable the usage of the cache to prevent these errors occurring? As they only occur in cache tables?

Any help very welcomed!

opgobee’s picture

In follow-up to my previous message 'PDOException error in cache table back again' where I attempt to find clues for the error, after having worked with Drupal 7 on a Virtual machine with Linux for half a year and not having the problem, now again tried the copy of Drupal 7 in XAMPP on Win and again a PDOException occurs, albeit another one: 

PDOException: SQLSTATE[22001]: String data, right truncated: 1406 Data too long for column 'name' at row 1 [...]
in drupal_write_record() (line 7401 of ....\XAMPP-7.3.3\htdocs\MYSITE\includes\common.inc).

This line 7401 executes a query to the database.

The similarity with my previous observations seems to be:

  • It is related to XAMPP
  • and it is related to 'TRUNCATE'

I think I will switch to VM with Linux. It would be valuable if there would be a solution to this issue because it makes Drupal 7 in XAMPP in fact unusable, at last in my experience up to now.

bmelland’s picture

I am seeing cache_discovery and cache_menu in the left-hand column but not within the main table within phpMyAdmin.

I keep receiving the following error message when running 'drush cc all' and/or 'drush cr':

In Connection.php line 686:

  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'xxx.cache_m

  enu' doesn't exist: CREATE TABLE {cache_menu} (

  `cid` VARCHAR(255) CHARACTER SET ascii BINARY NOT NULL DEFAULT '' COMMENT '

  Primary Key: Unique cache ID.',

  `data` LONGBLOB NULL DEFAULT NULL COMMENT 'A collection of data to cache.',

  `expire` INT NOT NULL DEFAULT 0 COMMENT 'A Unix timestamp indicating when t

  he cache entry should expire, or -1 for never.',

  `created` DECIMAL(14, 3) NOT NULL DEFAULT 0 COMMENT 'A timestamp with milli

  second precision indicating when the cache entry was created.',

  `serialized` SMALLINT NOT NULL DEFAULT 0 COMMENT 'A flag to indicate whethe

  r content is serialized (1) or not (0).',

  `tags` LONGTEXT NULL DEFAULT NULL COMMENT 'Space-separated list of cache ta

  gs for this entry.',

  `checksum` VARCHAR(255) CHARACTER SET ascii COLLATE ascii_general_ci NOT NU

  LL COMMENT 'The tag invalidation checksum when this entry was saved.',

  PRIMARY KEY (`cid`),

  INDEX `expire` (`expire`),

  INDEX `created` (`created`)

  ) ENGINE = InnoDB DEFAULT CHARACTER SET utf8mb4 COMMENT 'Storage for the ca

  che API.'; Array

  (

  )

In Statement.php line 59:

  SQLSTATE[42S02]: Base table or view not found: 1146 Table 'xxx.cache_m

  enu' doesn't exist

cache:rebuild [--cache-clear [CACHE-CLEAR]] [--no-cache-clear] [-h|--help] [-q|-

-quiet] [-v|vv|vvv|--verbose] [-V|--version] [--ansi] [--no-ansi] [-n|--no-inter

action] [-d|--debug] [-y|--yes] [--no] [--remote-host REMOTE-HOST] [--remote-use

r REMOTE-USER] [-r|--root ROOT] [-l|--uri URI] [--simulate] [--pipe] [-D|--defin

e DEFINE] [--druplicon] [--notify [NOTIFY]] [--xh-link XH-LINK] [--] <command>

e DEFINE] [--druplicon] [--notify [NOTIFY]] [--xh-link XH-LINK] [--] <command>

fab971’s picture

After several tests on "cache tables" i was not able to get rid of this bug. I finally created the missing table "ckeditor_input_format" in mysql as it should have been at the install level in ckeditor.install ::::

 

$schema['ckeditor_input_format'] = array(
    'description' => 'Stores CKEditor input format assignments',
    'fields' => array(
      'name' => array(
        'type' => 'varchar',
        'not null' => TRUE,
        'default' => '',
        'length' => 128,
        'description' => 'Name of the CKEditor role',
      ),
      'format' => array(
        'type' => 'varchar',
        'not null' => TRUE,
        'default' => '',
        'length' => 128,
        'description' => 'Drupal filter format ID',
      )
    ),
    'primary key' => array('name', 'format'),
  );

Every things went perfect after this...