Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
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.
Comment | File | Size | Author |
---|---|---|---|
#5 | password_policy-alter_efq_for_postgres_compatibility-2851352-5.patch | 561 bytes | COBadger |
#2 | password_policy-alter_efq_for_postgres_compatibility-2851352-2.patch | 561 bytes | COBadger |
Comments
Comment #2
COBadger CreditAttribution: COBadger as a volunteer commentedComment #3
COBadger CreditAttribution: COBadger as a volunteer commentedComment #5
COBadger CreditAttribution: COBadger as a volunteer commentedComment #7
AohRveTPV CreditAttribution: AohRveTPV commentedCOBadger, 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?
Comment #8
AohRveTPV CreditAttribution: AohRveTPV commentedI 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?
Comment #9
AohRveTPV CreditAttribution: AohRveTPV commentedA month has passed, still cannot reproduce.