Scenario: fresh install with sqlite and forum_access. When creating a forum post this bug is found:
PDOException: SQLSTATE[HY000]: General error: 25 bind or column index out of range: INSERT INTO {acl_node} (nid, acl_id, grant_view, grant_update, grant_delete, priority) SELECT n.nid AS nid, 4 AS acl_id, 1 AS grant_view, 1 AS grant_update, 1 AS grant_delete, 0 AS priority FROM {taxonomy_index} n WHERE (n.tid = :db_condition_placeholder_1) ; Array ( [:db_condition_placeholder_0] => 4 ) in acl_add_nodes() (line 117 of /var/www/gcms/sites/all/modules/contrib/acl/acl.module).
This seems sqlite specific. I was unable to reproduce with mysql.
On further debugging:
* The query is executed correctly in sqlite console.
* I realized that the subselect query results empty.
So it seems a bug with the pdo driver.
Comments
Comment #1
jonhattanHere's a workaround.
Comment #3
jonhattanNote: I don't have a great expectative of getting this patch accepted, since the bug must be fixed upstream.
Comment #4
salvisThank you for pursuing this to the bottom.
So, SQLite fails on INSERT FROM SELECT if the subquery returns an empty set, right?
The patch looks good but the code structure is not as straight-forward as it used to be.
Please do the following:
1. Create an issue in the SQLite queue about the underlying problem.
2. Provide patch with a separate code path for sqlite (so that the code paths for the other databases remain unchanged), add a two-line explanation plus references to the issues in the SQLite queue as well as this one, so that we can remove it easily once it's not needed anymore.
That'll have a very good chance for going in.
Comment #5
salvisNo follow-up, so I'm assuming that this was fixed in the SQLite driver.