I get this exception only after I created my own content type other than the default ones:
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 'ESCAPE '\\') ) GROUP BY i.type, i.sid HAVING (COUNT(*) >= '2') ) subquery' at line 4: SELECT COUNT(*) AS expression FROM (SELECT i.sid AS sid FROM {search_index} i INNER JOIN {node} n ON n.nid = i.sid INNER JOIN {search_total} t ON i.word = t.word INNER JOIN {search_dataset} d ON i.sid = d.sid AND i.type = d.type WHERE (n.status = :db_condition_placeholder_0) AND( (i.word = :db_condition_placeholder_1) OR (i.word = :db_condition_placeholder_2) )AND (i.type = :db_condition_placeholder_3) AND (n.type NOT IN (:db_condition_placeholder_4_0, :db_condition_placeholder_4_1)) AND( (d.data LIKE :db_condition_placeholder_4_0, :db_condition_placeholder_4_1 ESCAPE '\\') ) GROUP BY i.type, i.sid HAVING (COUNT(*) >= :matches) ) subquery; Array ( [:db_condition_placeholder_0] => 1 [:db_condition_placeholder_1] => comis [:db_condition_placeholder_2] => conventio [:db_condition_placeholder_3] => node [:matches] => 2 [:db_condition_placeholder_4_0] => page [:db_condition_placeholder_4_1] => did_you_know ) in PagerDefault->execute() (line 74 of /media/webserverdocs/7/production/drupal-7.4/includes/pager.inc).
....I re-stored a backup of a fresh install and it worked fine until I created a new content type. I tested with and without the the mod and I get the PDOException with the mod.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | modules-2.tar_.gz | 1.71 MB | Vc Developer |
| #8 | modules-3.tar_.gz | 2.39 MB | Vc Developer |
| #8 | modules-1.tar_.gz | 2.23 MB | Vc Developer |
| #8 | drupal72_toa_db07-05-2011-TestData.sql_.gz | 1014.27 KB | Vc Developer |
| #1 | permissions.png | 16.58 KB | Vc Developer |
Comments
Comment #1
Vc Developer commentedThis is how my settings look.
Comment #2
Vc Developer commentedI did another test giving anonymous users full content search and it works as expected, but I want to be able to give full search to registered user only.
Comment #3
alan d. commentedIt looks like this is a bug in core DB, there is this bit in the query that that is wrong. However, it would be good to see what triggered this to fix the trigger here and then pass it along into the core queue to fix that too!
What was the machine name of the new content type? This should be the only thing that differs between the core content types and the new content types.
Comment #4
Vc Developer commentedMachine name: did_you_know
Should this be a one word name?
Comment #5
alan d. commentedI tried with "did_you_know_" and I couldn't replicate the error.
What version of Drupal are you using? Any other access or search related modules installed?
Comment #6
alan d. commentedAnd trying a machine name of didyouknow would be an interesting test if you have time.
Cheers
Comment #7
Vc Developer commentedD7.4
Ooops! I didn't mention additional details of how I was searching! In the Advance Search Form I did a "Containing the phrase" search and that's when I got the PDOException.
Comment #8
Vc Developer commentedHere's my mysql test data and modules folder. Used phpmyadmin to compress the data. And the password is 123admin
Comment #9
alan d. commentedCool, I've got these, so you can remove the above files if you can / want. I'll look at setting up a test site tonight.
Comment #10
alan d. commentedInstalled, tested and I can not replicate this issue!
Can you write down step by step how to get the error?
I ran tests as user = 0, user = 1 and another user (uid = ?), searches.
Also, what version of MySQL / PHP are you using?
Comment #11
Vc Developer commentedMySql: 5.1.41-3ubuntu12.10
PHP: 5.3.2-1ubuntu4.9
Steps:
1) Did a normal search from one of the words from a generated post.
2) After the results I did a 'word phrase' search using the same word + the word next to it forming a phrase from the content.
For example:
A Post:
Autem ille paratus plaga suscipit. Autem mauris metuo minim quidne quis. Aliquip consectetuer laoreet occuro quadrum. Cogo dolore fere imputo jugis magna similis tincidunt. Ad autem diam hendrerit meus rusticus. Autem dignissim feugiat gilvus quidne.
--->Then search all post with 'autem'
Results:
Autem ille paratus plaga suscipit. Autem mauris metuo minim quidne quis. Aliquip consectetuer laoreet occuro quadrum. Cogo dolore fere imputo jugis magna similis tincidunt. Ad autem diam hendrerit meus rusticus. Autem dignissim feugiat gilvus quidne.
Autem ille paratus plaga suscipit. Autem mauris metuo minim quidne quis. Aliquip consectetuer laoreet occuro quadrum. Cogo dolore fere imputo jugis magna similis tincidunt. Ad autem .......
blah...
blah..
.....
--->now do a search to trim down hits with 'autem diam' (now I only want every post like the first hit) and this is when I get the PDOException on the anonymous...
Comment #12
alan d. commentedThis was a strange core bug, from memory there is a preg_replace() or something similar in the core DB code, so there is a error there!
Right, I'll push through a new release soon, but changing the code from:
to this resolved it!
Stranger still, the rewrite happens a number of times successfully before failing! Thanks for the time you spent helping track this bug!
cheers
Alan
Comment #13
alan d. commentedThe new release has been published. Reopen if you have any more issues
Comment #14
Vc Developer commentedYour welcome! It's a pleasure and want to help make Drupal the best CMS! I'll download the new release and if anything comes up I'll let you know! ;)
Comment #16
rishabh318 commentedHi All,
I have this query. don't know why this query gives an error.
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 'key = '\'SVTgikKQVSoimianTHBXGZ5vDXXa8_JAI1MiR5kHtsg\'') )' at line 1: DELETE FROM {uc_file_users} WHERE ( (uid = :db_condition_placeholder_0) AND (pfid = :db_condition_placeholder_1) AND (key = :db_condition_placeholder_2) ); Array ( [:db_condition_placeholder_0] => 2 [:db_condition_placeholder_1] => 3 [:db_condition_placeholder_2] => 'SVTgikKQVSoimianTHBXGZ5vDXXa8_JAI1MiR5kHtsg' ) in project_licenses_remove_submit() (line 821 of ......
Please Help me.
Comment #17
alan d. commentedTry the forums for misc coding questions.