Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1a6kbT-0008NN-60 for pgsql-bugs@arkaria.postgresql.org; Wed, 09 Dec 2015 19:40:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1a6kbS-00078W-OW for pgsql-bugs@arkaria.postgresql.org; Wed, 09 Dec 2015 19:40:42 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1a6kbR-00074K-Kn for pgsql-bugs@postgresql.org; Wed, 09 Dec 2015 19:40:41 +0000 Received: from plane.gmane.org ([80.91.229.3]) by makus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1a6kbO-0001UQ-3y for pgsql-bugs@postgresql.org; Wed, 09 Dec 2015 19:40:40 +0000 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1a6kbG-0004mz-2I for pgsql-bugs@postgresql.org; Wed, 09 Dec 2015 20:40:30 +0100 Received: from ppp-46-244-200-194.dynamic.mnet-online.de ([46.244.200.194]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 09 Dec 2015 20:40:30 +0100 Received: from spam_eater by ppp-46-244-200-194.dynamic.mnet-online.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 09 Dec 2015 20:40:30 +0100 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-bugs@postgresql.org From: Thomas Kellerer Subject: Re: BUG #13808: Upsert not working Date: Wed, 9 Dec 2015 20:40:17 +0100 Lines: 26 Message-ID: References: <20151209090153.872.86659@wrigleys.postgresql.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: ppp-46-244-200-194.dynamic.mnet-online.de User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.8.1.21) Gecko/20090302 Thunderbird/2.0.0.21 Mnenhy/0.7.5.666 In-Reply-To: <20151209090153.872.86659@wrigleys.postgresql.org> X-Pg-Spam-Score: -0.1 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org 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