The following error message appeared after enabling private_taxonomy in my Drupal 7.12 installation.

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] => GFSA3 ) em DrupalDefaultEntityController->load() (linha 196 de /opt/cart/includes/entity.inc).

Interesting to say that the term "GFSA3" which appears in this message is from a public taxonomy vocabulary, not the one I enabled as "Private".

Also, the message appeared during validation process for node updating. Exactly when I tried to add the private vocabulary term recently created (by the user) into the new field created for the node type (existing node). Than I reproduced the problem trying to create a new node instead of updating.

The private vocabulary is used in the content type field.
The public vocabulary is used for field collection field from same content type.

Permissions are set as following:

Private Taxonomy:

administer own taxonomy (AuthUser / Admin)

Taxonomy:

Administer vocabularies and terms (Admin)
Edit terms in PRIVATE VOCABULARY (AuthUser / Admin)
Delete terms in PRIVATE VOCABULARY (AuthUser / Admin)
Edit terms in PUBLIC VOCABULARY (Admin)
Delete terms in PUBLIC VOCABULARY (Admin)

The error could not be reproduced by user-1. It worked fine in this case.

PS: Seams that the problem is related to some public taxonomy term handling and permissions. The problem is not present after disable private_taxonomy module. But of course, without module features :(

CommentFileSizeAuthor
#18 error-2.PNG33.21 KBalok1985
#18 error-1.PNG71.33 KBalok1985

Comments

naoliva’s picture

Adding some info:

Installed modules: ( Content Access, Date, Ctools, Field Collection, Field Collection Table, Entity, Views, Sweaver )

trobey’s picture

Status: Active » Postponed (maintainer needs more info)

I enabled these modules and attached a field collection with a public vocabulary and attached a private vocabulary to a content type. I had no problem creating content as a user other than user 1 with the described permissions. Additional information is required so I can reproduce this error.

trobey’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

I believe this is the same bug as #1490116: Selecting multiple terms causes a PDO error. and has been fixed.

kruser’s picture

Version: 7.x-1.0 » 7.x-1.1

I'm getting this too for users other than user 1. In the case below, I had 2 term reference fields and neither were set to Private.

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.

#0 /home/sickjour/public_html/includes/database/database.inc(2139): PDOStatement->execute(Array)
#1 /home/sickjour/public_html/includes/database/database.inc(664): DatabaseStatementBase->execute(Array, Array)
#2 /home/sickjour/public_html/includes/database/select.inc(1264): DatabaseConnection->query('SELECT base.tid...', Array, Array)
#3 /home/sickjour/public_html/includes/entity.inc(196): SelectQuery->execute()
#4 /home/sickjour/public_html/includes/common.inc(7585): DrupalDefaultEntityController->load(Array, Array)
#5 /home/sickjour/public_html/modules/taxonomy/taxonomy.module(1167): entity_load('taxonomy_term', Array, Array)
#6 /home/sickjour/public_html/modules/taxonomy/taxonomy.module(1596): taxonomy_term_load_multiple(Array, Array)
#7 /home/sickjour/public_html/includes/form.inc(1379): taxonomy_autocomplete_validate(Array, Array, Array)
#8 /home/sickjour/public_html/includes/form.inc(1265): _form_validate(Array, Array)
#9 /home/sickjour/public_html/includes/form.inc(1265): _form_validate(Array, Array)
#10 /home/sickjour/public_html/includes/form.inc(1108): _form_validate(Array, Array, 'logsick_node_fo...')
#11 /home/sickjour/public_html/includes/form.inc(835): drupal_validate_form('logsick_node_fo...', Array, Array)
#12 /home/sickjour/public_html/includes/form.inc(366): drupal_process_form('logsick_node_fo...', Array, Array)
#13 /home/sickjour/public_html/includes/form.inc(123): drupal_build_form('logsick_node_fo...', Array)
#14 /home/sickjour/public_html/modules/node/node.pages.inc(66): drupal_get_form('logsick_node_fo...', Object(stdClass))
#15 [internal function]: node_add('logsick')
#16 /home/sickjour/public_html/includes/menu.inc(517): call_user_func_array('node_add', Array)
#17 /home/sickjour/public_html/index.php(21): menu_execute_active_handler()
#18 {main}
trobey’s picture

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

I created two vocabularies, attached them to a content type, created a user and added content with no error.

dkre’s picture

Status: Closed (cannot reproduce) » Needs review

I had the same error but not specifically in regard to permissions this was on 7.14 developing on xampp.

It seems that if you don't edit the operation of the field (in content type) then it doesn't pass the settings on. Silly. In my case the default values were what I wanted and appeared when I went the edit the term reference field.

trobey’s picture

Priority: Critical » Normal
Status: Needs review » Postponed (maintainer needs more info)

The status "Needs review" is for when "A patch has been created and needs review and testing." I do not see a patch anywhere but would be happy to review one if it is posted. In the absence of a patch I need to have a a sufficient description of the problem that I can reproduce it. Currently I cannot reproduce the error.

robbdavis’s picture

I was getting this error when I entered any taxonomy term (in this case called "tags"). I fixed this by going to the content type setting page (in this case it was an "article"). I clicked on the "manage fields" tab then found the "term reference" field and clicked on the edit link (at the end of the row).

For me the problem was that the number of values in the " 'tags' field settings" section was set to one. I changed this to five and the PDO exception error disappeared.

Hope this makes senes / helps somebody.

trobey’s picture

@robbdavis: Your report is reasonably detailed so I had some hope I might be able to reproduce it. I spun up a new site with just the Private Taxonomy module. I made the Tags vocabulary private and created a term. I tried creating content as both the site admin and an authenticated user. I changed the number of values from unlimited to one and repeated trying to make content as both users. I tried changing the permissions for the authenticated user to various permutations for the Private Taxonomy permissions. At no time did I encounter a PDO exception error.

robbdavis’s picture

@trobey Hey man; I'm sorry you went through all that trouble. I wasn't actually using the private taxonomy terms module. I was just responding to the PDO exception error I was getting using regular taxonomy.

My set up was from an installation profile so the creator of that installation probably set it up wrong in the first place.... it probably wasn't a bug from any code.

Sorry again for the trouble and kudos to you for replying so quickly; Drupal is awesome because of maintainers like you.

Robb.

globber’s picture

Had the same issue... had to allow "Administer vocabularies and terms" for each role that needed to add terms to the taxonomy, not just admin.

romaingar’s picture

Me too, same issue with the widget taxonomy autocomplete when i try to translate a node (Internationalization) who have a field with terms inside... i've swith to a select list widget and it works again...

trobey’s picture

I have updated the development branch with a new Private Term Reference field which should take care of some of these issues. See issue #1713424: Problem with private taxonomy terms.

trobey’s picture

Status: Postponed (maintainer needs more info) » Needs review
trobey’s picture

Status: Needs review » Closed (fixed)
alok1985’s picture

Priority: Normal » Critical
Issue tags: +PHP

The following error message appeared after done changes in view of one of my page. This error is only shows that particular page.
The exact error message appeared in An AJAX HTTP error occurred. HTTP result code:500 statustext : service unavailable.
On checking log the below error message appeared.
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, base.uuid AS uuid, v.machine_name AS vocabulary_machine_name FROM {taxonomy_term_data} base INNER JOIN {taxonomy_vocabulary} v ON base.vid = v.vid WHERE (base.tid IN ()) ; Array ( ) in DrupalDefaultEntityController->load() (line 191 of /var/www/smcin/public_html/includes/entity.inc).

trobey’s picture

I am not sure where to begin. This error seems to be associated with a view? The error is caused by the part of the SQL

base.tid IN ()

So no tids are supplied. But I cannot reproduce this with the information given. There is no information about what version is being used nor the view that is used. Hopefully a simple view could be created that demonstrates the problem.

alok1985’s picture

StatusFileSize
new71.33 KB
new33.21 KB

I am using Drupal version 7.34 and Apache/2.4.6 (CentOS) OpenSSL/1.0.2k-fips PHP/5.6.40. this error is arise when I update drupal recommended module security patches. On checking with module I found one module IDS - FORM ALTER if I disable it the error is disappeared but the item in my webpage not visible. And on enabling error again occurred.

attached screenshot of error
https://www.drupal.org/files/issues/2019-07-31/error-1.PNG
https://www.drupal.org/files/issues/2019-07-31/error-2.PNG