Problem/Motivation

When the password_policy module is enabled in a site using Postgres instead of mysql, the function _password_policy_was_user_blocked_due_to_expiration() causes a server error, as it attempts to use an alias in the value of a WHERE clause, which is disallowed in Postgres.

Admittedly this is a niche issue, as relatively few Drupal sites run on Postgres.

Proposed resolution

Replace the relevant implementation of selectquery::condition method with an implementation of the selectquery::having method.

Remaining tasks

Patch forthcoming.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

COBadger created an issue. See original summary.

COBadger’s picture

COBadger’s picture

Status: Active » Needs review

Status: Needs review » Needs work
COBadger’s picture

Version: 7.x-1.12 » 7.x-1.x-dev
Assigned: COBadger » Unassigned
Status: Needs work » Needs review
FileSize
561 bytes

Status: Needs review » Needs work
AohRveTPV’s picture

COBadger, could you please help me to better understand this bug? What do you mean by "it attempts to use an alias in the value of a WHERE clause"? Both 'blocked' and 'unblocked' are columns of {password_policy_expiration}. How is an alias involved?

AohRveTPV’s picture

Status: Needs work » Postponed (maintainer needs more info)

I executed _password_policy_was_user_blocked_due_to_expiration() on a site using PostgreSQL 9.4 and Password Policy 7.x-1.x-dev without error. I did so by:
1. As administrator (uid 1), created an expiration policy that applies to 'authenticated user'.
2. Created a new user 'foo'.
3. Blocked user ' foo'.

This caused _password_policy_was_user_blocked_due_to_expiration() to be executed, but I see no error.

So, I cannot reproduce this bug. Can you please give steps to reproduce it?

AohRveTPV’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)

A month has passed, still cannot reproduce.