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