Re: BUG #13808: Upsert not working - Mailing list pgsql-bugs

From Thomas Kellerer
Subject Re: BUG #13808: Upsert not working
Date
Msg-id n4a033$tv$1@ger.gmane.org
Whole thread Raw
In response to BUG #13808: Upsert not working  (tarunt@chisquare.in)
List pgsql-bugs
tarunt@chisquare.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

pgsql-bugs by date:

Previous
From: Andres Freund
Date:
Subject: Re: BUG #13808: Upsert not working
Next
From: Alvaro Herrera
Date:
Subject: Re: BUG #13809: Reassign owned throws error