Defect #19595

Broken "receiving emails"

Added by Semyon Dubina over 2 years ago. Updated over 2 years ago.

Status:ClosedStart date:
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Email receiving
Target version:-
Resolution:Duplicate Affected version:3.0.1

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 ('')) 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

Duplicates Redmine - Defect #19485: Column 'address' in where clause may be ambiguous Closed

History

#1 Updated by Toshi MARUYAMA over 2 years ago

  • Status changed from New to Closed
  • Resolution set to Duplicate

Duplicate of #19485.

#2 Updated by Toshi MARUYAMA over 2 years ago

  • Duplicates Defect #19485: Column 'address' in where clause may be ambiguous added

#3 Updated by Go MAEDA over 2 years ago

Thank you for investigating.
I pasted the workaround on #19485-6.

Also available in: Atom PDF