After enabling the module on my site running Drupal 7.41, I get the following error when trying to load the site as anonymous user:

PDOException:

SQLSTATE[HY093]: Invalid parameter number: parameter was not defined: SELECT COUNT(*) AS expression
FROM 
(SELECT 1 AS expression
FROM 
{node} n
WHERE (  ([n].[promote] = :db_condition_placeholder_0) AND ([n].[status] = :db_condition_placeholder_1) AND ( EXISTS  (SELECT na.[nid] AS [nid]
FROM 
{node_access} na
WHERE ( (( ([na].[gid] = :db_condition_placeholder_7) AND ([na].[realm] = :db_condition_placeholder_8) )OR( ([na].[gid] = :db_condition_placeholder_9) AND ([na].[realm] = :db_condition_placeholder_10) )OR( ([na].[gid] = :db_condition_placeholder_11) AND ([na].[realm] = :db_condition_placeholder_12) ))AND ([na].[grant_view] >= :db_condition_placeholder_13) AND (n.nid = na.nid)  )))  )) subquery; Array
(
    [:db_condition_placeholder_0] => 1
    [:db_condition_placeholder_1] => 1
    [:db_condition_placeholder_2] => 0
    [:db_condition_placeholder_3] => content_access_author
    [:db_condition_placeholder_4] => 1
    [:db_condition_placeholder_5] => content_access_rid
    [:db_condition_placeholder_6] => 1
)

in PagerDefault->execute() (line 74 of C:\vhosts\DrupalTest\includes\pager.inc).

Additionally, when trying to access a node directly by appending node/XX to the site root's URL, or just appending user, I get this error:

PDOException:

SQLSTATE[07002]: [Microsoft][ODBC Driver 11 for SQL Server]COUNT field incorrect or syntax error: SELECT n.[nid] AS [nid]
FROM 
{node} n
WHERE (  ([n].[status] = :db_condition_placeholder_0) AND ([n].[nid] IN  (:db_condition_placeholder_1, :db_condition_placeholder_2, :db_condition_placeholder_3)) AND ( EXISTS  (SELECT na.[nid] AS [nid]
FROM 
{node_access} na
WHERE ( (( ([na].[gid] = :db_condition_placeholder_0) AND ([na].[realm] = :db_condition_placeholder_1) )OR( ([na].[gid] = :db_condition_placeholder_2) AND ([na].[realm] = :db_condition_placeholder_3) )OR( ([na].[gid] = :db_condition_placeholder_4) AND ([na].[realm] = :db_condition_placeholder_5) ))AND ([na].[grant_view] >= :db_condition_placeholder_6) AND (n.nid = na.nid)  )))  ); Array
(
    [:db_condition_placeholder_0] => 1
    [:db_condition_placeholder_1] => 12
    [:db_condition_placeholder_2] => 18
    [:db_condition_placeholder_3] => 19
    [:db_condition_placeholder_4] => 1
    [:db_condition_placeholder_5] => content_access_rid
    [:db_condition_placeholder_6] => 1
)

in menu_tree_check_access() (line 1497 of C:\vhosts\DrupalTest\includes\menu.inc).

The front page of the site is of content type "Basic page". Per content node access control for this type is disabled. Anonymous user has permissions to view any page, and view own pages in Access Control tab for this content type.

Permissions for Anonymous user are enabled for View published content and View own unpublished content. When they are disabled, the error goes away and instead the anonymous user sees the Access Denied page.

I have rebuilt the permissions and cleared the cache many times and that doesn't change anything. I have tried installing the dev version 7.x-1.x-dev and had the same problem.

Comments

karoop created an issue. See original summary.

karoop’s picture

Issue summary: View changes

Updated Drupal to 7.41 and the issue is still present.

karoop’s picture

Assigned: Unassigned » karoop
Status: Active » Closed (fixed)

I fixed the issue by updating the sqlsrv module to the latest version.