Re: BUG #13808: Upsert not working

From: Thomas Kellerer <spam_eater(at)gmx(dot)net>
To: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #13808: Upsert not working
Date: 2015-12-09 19:40:17
Message-ID: n4a033$tv$1@ger.gmane.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

tarunt(at)chisquare(dot)in schrieb am 09.12.2015 um 10:01:
> The following bug has been logged on the website:
>
> INSERT INTO user_first_last AS ufl (UserId,
> FirstLoginDate,LastLoginDate,FirstLoginAmt,LastLoginAmt)
> select id, fdd, ldd,fda, lda
> from daily_deposits
> ON CONFLICT (UserId)
> DO UPDATE
> SET FirstLoginAmt = case when excluded.fdd < ufl.FirstLoginDate then
> excluded.fda else ufl.FirstLoginAmt END,
> LastLoginAmt = case when excluded.ldd > ufl.LastLoginDate then
> excluded.lda else ufl.LastLoginAmt END,
> FirstLoginDate = case when excluded.fdd < ufl.FirstLoginDate then
> excluded.fdd else ufl.FirstLoginDate END,
> LastLoginDate = case when excluded.ldd > ufl.LastLoginDate then
> excluded.ldd else ufl.LastLoginDate END;
>
> ERROR: column excluded.fdd does not exist
> LINE 6: SET FirstLoginAmt = case when excluded.fdd < ufl.FirstLogi...
> ^

You already have a perfectly valid answer: http://stackoverflow.com/a/34166088/330315

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message Alvaro Herrera 2015-12-09 21:09:51 Re: BUG #13809: Reassign owned throws error
Previous Message Andres Freund 2015-12-09 19:18:09 Re: BUG #13808: Upsert not working