Project

General

Profile

Actions

Defect #19595

closed

Broken "receiving emails"

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

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Email receiving
Target version:
-
Start date:
Due date:
% Done:

0%

Estimated time:
Resolution:
Duplicate
Affected version:

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

Is duplicate of Redmine - Defect #19485: Column 'address' in where clause may be ambiguousClosedJean-Philippe Lang

Actions
Actions

Also available in: Atom PDF