On the admin/user/advuser page I'm getting a query error. I looks like the problem is on line 306 of advuser.module. Postgres says it must be type boolean, but it must be more than that, as simply changing the '1' to TRUE just caused more errors for me. There are some complicated things happening in the advuser_admin_user_build_filter_query() and I'm really hoping I can get some help with this one. :)

Here's the error:

  • warning: pg_query() [function.pg-query]: Query failed: ERROR: argument of AND must be type boolean, not type integer in /usr/share/drupal/includes/database.pgsql.inc on line 84.
  • user warning:
    query: SELECT COUNT(*) FROM users u LEFT JOIN profile_values pv ON u.uid = pv.uid LEFT JOIN profile_fields pf on pv.fid = pf.fid WHERE u.uid > 1 AND 1 GROUP BY u.uid HAVING SUM(IF(pf.fid = 14 AND pv.value = 'Marmot Employee',1,0)) = 1 in /usr/share/drupal/includes/database.pgsql.inc on line 103.
  • warning: pg_query() [function.pg-query]: Query failed: ERROR: argument of AND must be type boolean, not type integer in /usr/share/drupal/includes/database.pgsql.inc on line 84.
  • user warning:
    query: SELECT u.* FROM users u LEFT JOIN profile_values pv ON u.uid = pv.uid LEFT JOIN profile_fields pf on pv.fid = pf.fid WHERE u.uid > 1 AND 1 GROUP BY u.uid HAVING SUM(IF(pf.fid = 14 AND pv.value = 'Marmot Employee',1,0)) = 1 ORDER BY u.login DESC LIMIT 50 OFFSET 0 in /usr/share/drupal/includes/database.pgsql.inc on line 103.

I'm running php5 and postgreSQL 8.1 in drupal_4.7.3

Thanks! Jamie.

CommentFileSizeAuthor
#2 advuser.patch4.1 KBjaydub

Comments

Mojah’s picture

Hiya Jamie,

If you come up with a solution please post a patch. I'm completely clueless on postgreSQL 8.1.

Suggestions anybody?

Thank you.

jaydub’s picture

StatusFileSize
new4.1 KB

I have taken a quick pass at resolving the issue with Postgres here although I think it has more to do with a rather odd query setup involving creation of the WHERE and HAVING clauses. I also made 2 other changes just to update a few other items.

1) Update the user status drop down menu to default display of Active rather than Blocked as one would assume that Active is more than likely going to be the default user status desired when using this module

2) Changed the text output when no users found to use 'no users found' rather than 'no posts found'.

3) Removed the HAVING clause entirely from the function advuser_admin_user_build_filter_query() . I can't quite grok the concept behind the IF test here...Changed around the other parts to make sure that the 'AND 1' does not appear in the query string before the GROUP BY clause.

4) Postgres requires that any columns in the SELECT clause must also appear in the GROUP BY clause. I have checked the columns used from the user table in the relevant queries and have added them to the GROUP BY clause.

Right now I am building a Drupal installation and at the moment just have 2 users so I cannot readily test out these changes against a large userbase. If someone else is able to test out please do so. I will try and run through some tests with a larger userbase.

Arthaey’s picture

I'm getting similar errors, and the current version of advuser has changed to much for the patch to work. I've uninstalled this module until this bug has been fixed.

Anonymous’s picture

Assigned: Unassigned »
Anonymous’s picture

Status: Active » Fixed

Since this is old I'm closing the issue. Please open a new issue for issues with 6.x if you have them.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.