I get this error on the last page of the installler:
SQLSTATE[22025]: Invalid escape sequence: 7 ERROR: invalid escape string HINT: Escape string must be empty or one character.
The consequence here seems to be that the installation fails (since an ERROR means that no more commands will be processed until a new transaction is started).
The site is non-functional after this install (even though the final page say that Drupal was installed successfully).
The error I get when visiting the main site URL after this error is:
PDOException: SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near ")" LINE 1: SELECT * FROM menu_router WHERE path IN () ORDER BY fit DESC... ^: SELECT * FROM {menu_router} WHERE path IN () ORDER BY fit DESC LIMIT 1 OFFSET 0; Array ( ) in menu_get_item() (line 426 of /usr/srv/www/misc/mikkel.live.revealit.dk/includes/menu.inc).
Which seems to imply that there is also a check missing in menu_get_item, since it tries to make an IN-query with an empty array…
| Comment | File | Size | Author |
|---|---|---|---|
| #11 | 2010-09-18-core-910388-no-prefix.patch | 1.34 KB | mikl |
| #8 | 2010-09-18-core-910388.patch | 1.35 KB | mikl |
| #7 | 2010-09-14-core-910388.patch | 1.44 KB | mikl |
| Screen shot 2010-09-13 at 21.42.12.PNG | 49.36 KB | mikl |
Comments
Comment #1
miklSpun the IN-query part out as #910400: SQL error in menu_get_items when menu items has no ancestors and router item is not in cache..
Comment #2
miklAh, the plot thickens:
PostgreSQL appears not to like the " ESCAPE '\\\\'" that is added by DatabaseConnection_pgsql::mapConditionOperator(). The four backslashes means that the escape character is defined as two slashes (and not one).
Comment #3
damien tournoud commentedHm. PostgreSQL and PDO do some weird things with string encoding.
Would you have a non-standard configuration for this configuration parameter?
Comment #4
miklOkay, I managed to stop the error from occurring by commenting out “standard_conforming_strings = on” in my postgresql.conf, thus returning to the old non-conforming string behaviour, which it seems that we are compensating for in our code.
This constitutes a problem in that “standard_conforming_strings = on” will be the default for PostgreSQL 9.1.
This hails back to #426008: C-style backslashe escapes in string constants cause errors or warnings in postgresql which I have closed myself, since the problem goes away when enabling standard_conforming_strings. I have also written a blog post explaining why standard_conforming_strings is a good thing.
I think we need to find some sort of solution to this that would work both with and without this setting enabled, since the current state of the code essentially forces you to use non-standard-conforming mode if you want to run Drupal. I’d like some input from the DBTNG maintainers…
Comment #5
damien tournoud commentedPDO itself knows how to properly escape strings depending on the
standard_conforming_stringsmode. The best we can do it probably to rely on it, via http://php.net/manual/en/pdo.quote.php.Could you provide a patch that does that? ie. replace
" ESCAPE '\\\\'"by" ESCAPE " . $this->quote("\\").Comment #6
webchickThis seems to be a site-specific configuration problem, rather than a global issue, so downgrading to major.
Comment #7
mikl#5: Yes, that seems to work. I’ve tested the attached patch both with and without the standard-conforming strings enabled, and it works either way. It does make the code less elegant, though: Using a function call inside a static declaration is a syntax error (which i spent a couple of hours banging my head against the wall about).
#6: It is not site-specific, but configuration specific. Many PostgreSQL servers are configured that way, specifically for compatibility with MySQL and Drupal 6, so it’d still say its rather critical to get in before D7 goes out :)
Comment #8
miklBy suggestion from Damien, I have shortened the comment about the static declarations. Otherwise this patch is identical to the one from #7.
Comment #9
damien tournoud commented#win.
This proves how passing string literal to SQL queries is evil.
Comment #11
miklForgot the --no-prefix to git diff…
Comment #13
mikl#11: 2010-09-18-core-910388-no-prefix.patch queued for re-testing.
Comment #14
miklReverting to RTBC after the test-bots shenanigans. See #9.
Comment #15
dries commentedCommitted to CVS HEAD. Thanks.
Comment #17
likewhoa commentedEven though this was committed to HEAD, the error is still active on a fresh copy of postgres-server-9.0, drupal-7.0_rc2 and nginx-0.8.53 running GNU/Gentoo Linux.
Comment #18
likewhoa commentedclosing this again* but there was one error after installation which I will open a bug report for.
Also another bug when adding content /node/add