Skip Navigation

[Resolved] WordPress database error Table doesn’t exist for…

This thread is resolved. Here is a description of the problem and solution.

Problem:
The user has updated Types plugin and the migration did not complete correctly. Some tables were missing.

Solution:
Because the user does not have any existing relationships, it is safe to build the tables manually using SQL queries.
https://toolset.com/forums/topic/wordpress-database-error-table-doesnt-exist-for/#post-2220473

This support ticket is created 3 years, 2 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 - - 9:00 – 13:00
14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 - - 14:00 – 18:00

Supporter timezone: Africa/Casablanca (GMT+01:00)

This topic contains 7 replies, has 2 voices.

Last updated by esztanygaleria-srlE 3 years, 1 month ago.

Assisted by: Jamal.

Author
Posts
#2217367

Hello,

We used "esztany3.borviz_com" subdomain for building our website, but we went live with "esztany.com" domain. After the switch we are seeing an error message in our logs... how can we get rid of it?

-------

e_relationships_per_origin, OTGS\Toolset\Common\Relationships\DatabaseLayer\RelationshipQuery\RelationshipQuery->get_results
[10-Nov-2021 06:32:42 UTC] WordPress database error Table 'FOw_esztany3_borviz_com.wp_toolset_relationships' doesn't exist for query SELECT
relationships.id AS id,
relationships.slug AS slug,
relationships.display_name_plural AS display_name_plural,
relationships.display_name_singular AS display_name_singular,
relationships.driver AS driver,
relationships.parent_domain AS parent_domain,
relationships.child_domain AS child_domain,
relationships.intermediary_type AS intermediary_type,
relationships.ownership AS ownership,
relationships.cardinality_parent_max AS cardinality_parent_max,
relationships.cardinality_parent_min AS cardinality_parent_min,
relationships.cardinality_child_max AS cardinality_child_max,
relationships.cardinality_child_min AS cardinality_child_min,
relationships.is_distinct AS is_distinct,
relationships.scope AS scope,
relationships.origin AS origin,
relationships.role_name_parent AS role_name_parent,
relationships.role_name_child AS role_name_child,
relationships.role_name_intermediary AS role_name_intermediary,
relationships.role_label_parent_singular AS role_label_parent_singular,
relationships.role_label_child_singular AS role_label_child_singular,
relationships.role_label_parent_plural AS role_label_parent_plural,
relationships.role_label_child_plural AS role_label_child_plural,
relationships.needs_legacy_support AS needs_legacy_support,
relationships.is_active AS is_active,
relationships.autodelete_intermediary AS autodelete_intermediary,
relationships.parent_types AS parent_types_set_id,
relationships.child_types AS child_types_set_id,
GROUP_CONCAT(DISTINCT parent_types_table.type) AS parent_types,
GROUP_CONCAT(DISTINCT child_types_table.type) AS child_types
FROM wp_toolset_relationships AS relationships
JOIN wp_toolset_type_sets AS parent_types_table
ON (relationships.parent_types = parent_types_table.set_id )
JOIN wp_toolset_type_sets AS child_types_table
ON (relationships.child_types = child_types_table.set_id )
WHERE ( ( relationships.child_domain = 'posts' ) AND ( child_types_table.type = 'page' ) ) AND ( 1 = 1 ) AND ( ( relationships.cardinality_parent_max = 1 ) AND ( relationships.cardinality_child_max != 1 ) ) AND ( relationships.is_active = 1 ) AND ( ( (
relationships.parent_domain != 'posts'
OR parent_types_table.type IN ( 'post', 'page', 'attachment', 'oembed_cache', 'user_request', 'wp_template', 'kadence_element', 'product', 'product_variation', 'shop_order', 'shop_order_refund', 'shop_coupon', 'cookielawinfo', 'kb_icon' )
) ) AND ( (
relationships.child_domain != 'posts'
OR child_types_table.type IN ( 'post', 'page', 'attachment', 'oembed_cache', 'user_request', 'wp_template', 'kadence_element', 'product', 'product_variation', 'shop_order', 'shop_order_refund', 'shop_coupon', 'cookielawinfo', 'kb_icon' )
) ) ) GROUP BY relationships.id made by require('wp-blog-header.php'), wp, WP->main, WP->parse_request, do_action_ref_array('parse_request'), WP_Hook->do_action, WP_Hook->apply_filters, rest_api_loaded, WP_REST_Server->serve_request, WP_REST_Server->dispatch, WP_REST_Server->respond_to_request, Toolset\DynamicSources\Rest\Cache->get_cache, do_action('toolset/dynamic_sources/actions/register_sources'), WP_Hook->do_action, WP_Hook->apply_filters, Toolset\DynamicSources\DynamicSources->register_sources, Toolset\DynamicSources\Registration->register_post_providers, apply_filters('toolset/dynamic_sources/filters/register_post_providers'), WP_Hook->apply_filters, Toolset\DynamicSources\ToolsetSources\Main->Toolset\DynamicSources\ToolsetSources\{closure}, Toolset\DynamicSources\ToolsetSources\Main->get_toolset_post_providers, Toolset\DynamicSources\ToolsetSources\RelationshipService->get_relationships_acceptable_for_sources, toolset_get_relationships, OTGS\Toolset\Common\Relationships\DatabaseLayer\RelationshipQuery\RelationshipQuery->get_results

#2217449

Hello and thank you for contacting the Toolset support.

This error says that the relationships table from Toolset does not exist. That's not always true. Sometimes, during a huge load, errors accessing the database can be displayed as if a table does not exist. So, I need to know if you have any relationships, Repeatable Field Groups or Post Relationship Fields in your website? If they exists and are working fine, then this error is a false positive and most probably logged during a huge load period.

If they do not exist, then you will need to check in the database level if the table "wp_toolset_relationships" exists or not.

If it does not exist, deactivate Toolset Types, then reactivate it, and go to Toolset->Relationships. Let me know what you will get.

If this does not help figure out what's going on, allow me temporary access to your website and I'll check it closely. Your next reply will be private to let you share credentials safely. ** Make a database backup before sharing credentials. **

#2218589

Unfortunately, the credentials did not work for me. Can you check again from your side and update your next reply with a working password.

#2220163

Sorry Jamal - I updated the private message with the correct password.

#2220473

Thank you for the credentials. I was able to login and based on WooCommerce status page, the "wp_toolset_relationships" does not seem to exist on the database. hidden link

Because of that, we can't create a relationship. And this will also affect Repeatable Field Groups, and Post Reference fields.

I can't tell why this table is not present on the database. We can create it using the following SQL query:

-- phpMyAdmin SQL Dump
-- version 4.8.5
-- <em><u>hidden link</u></em>
--
-- Host: 127.0.0.1
-- Generation Time: Nov 14, 2021 at 09:59 AM
-- Server version: 10.1.38-MariaDB
-- PHP Version: 7.4.15

SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET AUTOCOMMIT = 0;
START TRANSACTION;
SET time_zone = "+00:00";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;

--
-- Database: `toolset-training`
--

-- --------------------------------------------------------

--
-- Table structure for table `wp_toolset_relationships`
--

CREATE TABLE `wp_toolset_relationships` (
  `id` bigint(20) UNSIGNED NOT NULL,
  `slug` varchar(190) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `display_name_plural` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `display_name_singular` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `driver` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `parent_domain` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `parent_types` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
  `child_domain` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `child_types` bigint(20) UNSIGNED NOT NULL DEFAULT '0',
  `intermediary_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `ownership` varchar(8) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'none',
  `cardinality_parent_max` int(10) NOT NULL DEFAULT '-1',
  `cardinality_parent_min` int(10) NOT NULL DEFAULT '0',
  `cardinality_child_max` int(10) NOT NULL DEFAULT '-1',
  `cardinality_child_min` int(10) NOT NULL DEFAULT '0',
  `is_distinct` tinyint(1) NOT NULL DEFAULT '0',
  `scope` longtext COLLATE utf8mb4_unicode_ci NOT NULL,
  `origin` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `role_name_parent` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `role_name_child` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `role_name_intermediary` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `role_label_parent_singular` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `role_label_child_singular` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `role_label_parent_plural` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `role_label_child_plural` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT '',
  `needs_legacy_support` tinyint(1) NOT NULL DEFAULT '0',
  `is_active` tinyint(1) NOT NULL DEFAULT '0',
  `autodelete_intermediary` tinyint(1) NOT NULL DEFAULT '1'
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;

--
-- Indexes for dumped tables
--

--
-- Indexes for table `wp_toolset_relationships`
--
ALTER TABLE `wp_toolset_relationships`
  ADD PRIMARY KEY (`id`),
  ADD KEY `slug` (`slug`),
  ADD KEY `is_active` (`is_active`),
  ADD KEY `needs_legacy_support` (`needs_legacy_support`),
  ADD KEY `parent_type` (`parent_domain`,`parent_types`),
  ADD KEY `child_type` (`child_domain`,`child_types`);

--
-- AUTO_INCREMENT for dumped tables
--

--
-- AUTO_INCREMENT for table `wp_toolset_relationships`
--
ALTER TABLE `wp_toolset_relationships`
  MODIFY `id` bigint(20) UNSIGNED NOT NULL AUTO_INCREMENT;
COMMIT;

/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;

I wouldn't recommend to create the table directly on the live server. It would be better to test on a staging site and make sure that the site works as expected before doing on the live server.

Let me know if you would need my assistance to perform this. I'll set your next reply as private to let you share credentials to the staging site privately. For the live site, please make a database backup before we can work on it.

#2221313

Thank you Jamal
hidden link
same credentials

I did a backup for the live website as well.

#2221385

Thank you for the staging site. I installed the "My Database Admin" plugin to help me run the SQL queries without needing phpMyAdmin or Adminer.

The SQL query was run successfully. It created the table, and I was able to create a Toolset relationship.

I performed the same on the live site, and the table was created successfully as you can see in the WooCommerce Status page.
hidden link

The used plugin is now deactivated and deleted from the live site. Let me know if you have any further questions.

#2223001

Thank you Jamal for all your help! I'm very grateful 🙂
Thank you again.