From: Thomas Kellerer <spam_eater@gmx.net>
To: pgsql-bugs@postgresql.org
Subject: Re: BUG #13808: Upsert not working
Date: Wed, 9 Dec 2015 20:40:17 +0100
Message-ID: <n4a033$tv$1@ger.gmane.org> (raw)
In-Reply-To: <20151209090153.872.86659@wrigleys.postgresql.org>
References: <20151209090153.872.86659@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: spam_eater@gmx.net
Subject: Re: BUG #13808: Upsert not working
In-Reply-To: <n4a033$tv$1@ger.gmane.org>
References: <20151209090153.872.86659@wrigleys.postgresql.org> <n4a033$tv$1@ger.gmane.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox