Hi there,
I have a D7 site installed with a prefix to the drupal tables. When I want to add a custom table got an error like this:

PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'default.PREFIX_' doesn't exist: DESCRIBE { TABLE_NAME }; Array ( ) in function view_custom_table_add_custom_table_column_relationship_form() (line 106 in file /var/www/web/sites/all/modules/contrib/view_custom_table/view_custom_table.admin.inc).

Comments

tibezh created an issue. See original summary.

tibezh’s picture

Status: Active » Needs review
StatusFileSize
new1.75 KB

A patch with a solution attached.

apparatchik’s picture

This is also an issue in the 8.x branch, manually replacing { @table_name } with {@table_name} in the corresponding files fixes it.

darkodev’s picture

Upgraded to Drupal core 7.78 today and got a new error like the one below, which this patch solves for us by removing the spaces. Since we are not using table prefixes, I don't think prefix is pertinent to this issue ie. it will happen all the time on latest Drupal core since 7.76, I believe, when changes were made in handling table names in preparation for MySQL 8.

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1103 Incorrect table name ' table_name_here ': DESCRIBE { table_name_here }; Array ( ) in view_custom_table_views_data() (line 174 of /path/to/view_custom_table.module).

geoffray’s picture

Had the same error than darkodev after a Drupal core update, seems effectively related to the Drupal 7.76 release where some changes were made at the table name quoting level. Patch #2 succesfully fixes the issue and should be merged urgently to a new Views Custom Table 7.x release because currently it breaks down any up-to-date Drupal 7 website.

oldspot’s picture

Status: Needs review » Reviewed & tested by the community

I've just had this issue again on a site and found this issue here then realised that I've created the exact same solution on this duplicate issue here and forgot about it :))
https://www.drupal.org/project/view_custom_table/issues/3186756

The patches are exactly the same and in both cases have been reviewed by several users so should probably be committed to the module as people seem to keep facing this issue.

joseph.olstad’s picture

  • joseph.olstad committed b04c863 on 7.x-1.x authored by tibezh
    Issue #3069124 by tibezh, apparatchik, darkodev, geoffray, oldspot:  "...
joseph.olstad’s picture

Status: Reviewed & tested by the community » Fixed

Thanks for the fix, I'll cut a new 7.x release shortly.

joseph.olstad’s picture

New release for Drupal 7 , version 7.x-1.0

download version 7.x-1.0

rajeshreeputra’s picture

Status: Fixed » Closed (fixed)
rajeshreeputra’s picture

Status: Closed (fixed) » Fixed

Status: Fixed » Closed (fixed)

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