After installing password policy 6.x-1.0, I then configured it by clicking the Add tab to add a policy.

After selecting length, etc for passwords, saving gave this error:

user warning: Column 'name' in field list is ambiguous query: SELECT name FROM role r INNER JOIN password_policy_role p ON r.rid = p.rid WHERE p.pid = 1 in /**********/sites/all/modules/password_policy/password_policy.admin.inc on line 117.

CommentFileSizeAuthor
#9 1174318.sql-warning.patch654 byteswiifm

Comments

mojzis’s picture

i have the same problem here, is there any help to it, please ?

Slovak’s picture

Same issue here....

hbergin’s picture

Both the role table and password_policy_role table have a column called "name", which is the source of the "Column 'name' in field list is ambiguous query" error.

Prefixing the name in the field list with an r to specify the name should be taken from the role table should resolve this:

SELECT r.name FROM role r INNER JOIN password_policy_role p ON r.rid = p.rid WHERE p.pid = 1

tivie’s picture

yes hbergin is right.

Just change line 117 from:

$result = db_query('SELECT name FROM {role} r INNER JOIN {password_policy_role} p ON r.rid = p.rid WHERE p.pid = %d', $pid);

to

$result = db_query('SELECT r.name FROM {role} r INNER JOIN {password_policy_role} p ON r.rid = p.rid WHERE p.pid = %d', $pid);

AlexisWilke’s picture

Priority: Minor » Critical

Thank you for the fix. This is critical since the list of roles is required to be there.
Alexis Wilke

technikh’s picture

subscribing..

wiifm’s picture

Subscribe, can we get a new release rolled here? This is a little embarrassing for the module.

Can confirm that the two character fix mentioned above does fix the issue.

line 117 of password_policy.admin.inc :

$result = db_query('SELECT r.name FROM {role} r INNER JOIN {password_policy_role} p ON r.rid = p.rid WHERE p.pid = %d', $pid);
wiifm’s picture

Status: Active » Reviewed & tested by the community

setting status

wiifm’s picture

StatusFileSize
new654 bytes

Uploading a patch that is formatted correctly for drush make

halstead’s picture

RBTC from me as well.

erikwebb’s picture

Version: 6.x-1.0 » 6.x-1.x-dev
Assigned: Unassigned » erikwebb
Status: Reviewed & tested by the community » Fixed

Patched and committed as 6.x-1.1.

alexmartin’s picture

I ran in to this error yesterday so nice to see it's been addressed today. Thanks!

However, I've just installed 6.x-1.1, and I get the following error on update.php, even before running the update...

Warning: Call-time pass-by-reference has been deprecated in /var/www/vhosts/my-domain/httpdocs/sites/all/modules/password_policy/password_policy.install on line 305

erikwebb’s picture

This is being addressed in a separate issue - #1133216: Warning: Call-time pass-by-reference has been deprecated

I did not add this to the 6.x-1.1 release, because there was a critical bug that _had_ to be released. I made a lot of headway in the issue queue yesterday and will probably roll a 6.x-1.2 release by next week to address the issues I've resolved.

Status: Fixed » Closed (fixed)

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