Defect #19595
closedBroken "receiving emails"
0%
Description
After update 2.6.1 -> 3.0.1 fetching emails from an IMAP server is brokened with error:
PG::AmbiguousColumn: ERROR: column reference "address" is ambiguous
LINE 1: ...s"."type" IN ('User', 'AnonymousUser') AND (LOWER I...
^
: SELECT DISTINCT "users".* FROM "users" INNER JOIN "email_addresses" ON "email_addresses"."user_id" = "users"."id" WHERE "users"."type" IN ('User', >'AnonymousUser') AND (LOWER IN ('wordpress@itunion.info')) ORDER BY "users"."id" ASC LIMIT 1
In sql bothe tables(email_addresses and users) have column "address".
Not sure when the columns were created. If it is not "out of the box", then this one of some plugins.
Step-by-steb find out: having_mail have wrong condition:
joins(:email_addresses).where("LOWER(address) IN (?)", addresses).uniq
For me worked:
joins(:email_addresses).where("LOWER(email_addresses.address) IN (?)", addresses).uniq
Related issues
Updated by Toshi MARUYAMA over 9 years ago
- Status changed from New to Closed
- Resolution set to Duplicate
Duplicate of #19485.
Updated by Toshi MARUYAMA over 9 years ago
- Is duplicate of Defect #19485: Column 'address' in where clause may be ambiguous added
Updated by Go MAEDA over 9 years ago
Thank you for investigating.
I pasted the workaround on #19485-6.