Whenever I enter a tag value for an existing image I get the following error:

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '))' at line 2: SELECT base.tid AS tid, base.vid AS vid, base.name AS name, base.description AS description, base.format AS format, base.weight AS weight, v.machine_name AS vocabulary_machine_name FROM {taxonomy_term_data} base INNER JOIN {taxonomy_vocabulary} v ON base.vid = v.vid WHERE (base.name LIKE :db_condition_placeholder_0 ESCAPE '\\') AND (base.vid IN ()) ; Array ( [:db_condition_placeholder_0] => Products ) in DrupalDefaultEntityController->load() (line 196 of C:\xampp\htdocs\drupal-7\includes\entity.inc).

Comments

sniffypup’s picture

Further investigation (by comparing similar steps on a cleaner D7 installation) shows the issue may be related to the addition of the tag field.

On my system, when adding the field to any content type the vocabulary available is fixed as "Gallery Collection" (I have Media version 7.x-1.0-beta5 and Media Gallery version 7.x-1.0-beta6 installed). The same modules (and versions) are on the cleaner system but the problem doesn't occur there!

marcingy’s picture

Version: 7.4 » 7.7
Status: Active » Closed (cannot reproduce)

Can't reproduce on a core install on 7.7

leewoodman’s picture

I get the same error

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '))' at line 2: SELECT base.tid AS tid, base.vid AS vid, base.name AS name, base.description AS description, base.format AS format, base.weight AS weight, v.machine_name AS vocabulary_machine_name FROM {taxonomy_term_data} base INNER JOIN {taxonomy_vocabulary} v ON base.vid = v.vid WHERE (base.name LIKE :db_condition_placeholder_0 ESCAPE '\\') AND (base.vid IN ()) ; Array ( [:db_condition_placeholder_0] => C3 ) in DrupalDefaultEntityController->load() (line 196 of /home/afolder/public_html/mysite/includes/entity.inc).
The website encountered an unexpected error. Please try again later.

L

leewoodman’s picture

OK for me...i had deleted the taxonomy vocabulary and still had not updated the content type field to reflect the new taxonomy vocab name

Works fine now

Lee

glennamaddy’s picture

edited content type to refer to vocab, if you delete your vocab you'll have to repoint the content types to the new vocab

rdeboer’s picture

Status: Closed (cannot reproduce) » Active

Having this the moment I save a basic, core Article tag in 7.10!

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '))' at line 2: SELECT base.tid AS tid, base.vid AS vid, base.name AS name, base.description AS description, base.format AS format, base.weight AS weight, v.machine_name AS vocabulary_machine_name FROM {taxonomy_term_data} base INNER JOIN {taxonomy_vocabulary} v ON base.vid = v.vid WHERE (base.name LIKE :db_condition_placeholder_0 ESCAPE '\\') AND (base.vid IN ()) ; Array ( [:db_condition_placeholder_0] => whatever) in DrupalDefaultEntityController->load() (line 196 of .../includes/entity.inc).

Everett Zufelt’s picture

Status: Active » Patch (to be ported)

@RdeBoer

Do you have any contributed modules installed? Can you please provide steps to reproduce?

Everett Zufelt’s picture

Status: Patch (to be ported) » Active
rdeboer’s picture

At this stage I can only say that it was a Drupal 7.? install to begin with that was progressively upgraded to 7.10.
The optional "tags" on the Article type were never entered until today. The moment an existing Article is saved or previewed with a tag entered, the error occurs.
Very strange...

Everett Zufelt’s picture

Status: Active » Closed (cannot reproduce)
rdeboer’s picture

Status: Closed (cannot reproduce) » Closed (fixed)

After more research I found that in my case this error happend when the "field_tags" existed on the Article content type and appeared in the Field List at .../admin/reports/fields, but the underlying Taxonomy was somehow missing from the .../admin/structure/taxonomy page.

When I recreated the "Tags" taxonomy (machine name "tags") it worked!
Rik

mgifford’s picture

I just got this with the latest version of D7:

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM taxonomy_vocabulary base ORDER BY base.weight ASC, base.name ASC' at line 1: SELECT FROM {taxonomy_vocabulary} base ORDER BY base.weight ASC, base.name ASC; Array ( ) in DrupalDefaultEntityController->load() (line 196 of /DRUPAL7/includes/entity.inc).

There should be a better way to track this down though... I do think it's a matter of inserting the taxonomy, probably through phpMyAdmin.

utilum’s picture

Version: 7.7 » 7.19
Status: Closed (fixed) » Active

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '))' at line 2: SELECT base.tid AS tid, base.vid AS vid, base.name AS name, base.description AS description, base.format AS format, base.weight AS weight, v.machine_name AS vocabulary_machine_name FROM {taxonomy_term_data} base INNER JOIN {taxonomy_vocabulary} v ON base.vid = v.vid WHERE (base.name LIKE :db_condition_placeholder_0 ESCAPE '\\') AND (base.vid IN ()) ; Array ( [:db_condition_placeholder_0] => tx ) in DrupalDefaultEntityController->load() (line 196 of /includes/entity.inc).

To reproduce :
Install drupal minimal profile.
Enable taxonomy, field_ui.
Create vocabulary "Tags".
Create content type "Article".
Add field_tags of type Term reference to Article.
Create Article content type with some value in the tags field.
Click save.

interlated’s picture

Yes basic site. Using default 'Tags' taxonomy entry.

I added a new taxonomy and specified this in the content types editor and it works fine.

Therefore, using the default Tags taxonomy doesn't work. The content type has 'Tags defined' as the vocabulary. Root cause is that the taxonomy code doesn't find this in some way?

It looks like this: AND (base.vid IN ()) is the error. Scrolling through the above this syntax all looks incorrect and I have it too:

PDOException: SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '))' at line 2: SELECT base.tid AS tid, base.vid AS vid, base.name AS name, base.description AS description, base.format AS format, base.weight AS weight, v.machine_name AS vocabulary_machine_name FROM {taxonomy_term_data} base INNER JOIN {taxonomy_vocabulary} v ON base.vid = v.vid WHERE (base.name LIKE :db_condition_placeholder_0 ESCAPE '\\') AND (base.vid IN ()) ; Array ( [:db_condition_placeholder_0] => Republicanism ) in DrupalDefaultEntityController->load() (line 196 of /srv/bloggerme.com.au/web/includes/entity.inc).

John

duckydan’s picture

Issue summary: View changes

Yet another drupal.org page that just saved me. I had spent two hours troubleshooting a relatively simple View. Turned out a og_vocab field I had experiment with was left in the field_config_instance but not in field_config. It was causing silent failures when editing a View, and error messages when previewing it.

pabloirun’s picture

Hi,

In my case, deleting and creating again the field_tags in the article content type solved the problem.

Version: 7.19 » 7.x-dev

Core issues are now filed against the dev versions where changes will be made. Document the specific release you are using in your issue comment. More information about choosing a version.

Status: Active » Closed (outdated)

Automatically closed because Drupal 7 security and bugfix support has ended as of 5 January 2025. If the issue verifiably applies to later versions, please reopen with details and update the version.