Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fGiJw-0004Nz-KZ for pgsql-general@arkaria.postgresql.org; Thu, 10 May 2018 09:57:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fGiJv-0003JY-Fh for pgsql-general@arkaria.postgresql.org; Thu, 10 May 2018 09:57:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fGiJv-0003JP-5n for pgsql-general@lists.postgresql.org; Thu, 10 May 2018 09:57:07 +0000 Received: from mail-wm0-x244.google.com ([2a00:1450:400c:c09::244]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fGiJt-0003AO-60 for pgsql-general@lists.postgresql.org; Thu, 10 May 2018 09:57:06 +0000 Received: by mail-wm0-x244.google.com with SMTP id l1-v6so3299699wmb.2 for ; Thu, 10 May 2018 02:57:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=phNu7vrMcoKlva2R5yXtzQVWDoeIs0rq5IcSxzGnntw=; b=RTC8nYdkoC0cJblrLlKwAET9+yGft8D23P8ueYDuNYmr/QORrr/r+UwZDE4FNf/h+H WGG4Ma4GybPi5vbYC6pK/JL8F10k5VnlI0LaSDaJ8/NUKpWi/qt3ExOs7r8ny4Jxxb3d Qh13sY+K6f+TlwH71jR99XJNK1E11d3SzF0AHfyubMvKVI6ApNyii0OKHY2r/LhnVoKH 9DrTDsQZ7mRAOPN8ax3BTExZS78wpXRZ07XyeipzW0MHcyqoFJVl2ZXjVYjsErcI4QA9 u+bDZUCN6PEDYM7ZUR2yyw5x+QNU1Cq3pKjjdSqQ5DFFsct0mXaNXBMeLEmctE16apBS ryLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=phNu7vrMcoKlva2R5yXtzQVWDoeIs0rq5IcSxzGnntw=; b=bVYhas9NcKgu70ob1SkWwQ8T7v1x6icULKvbKpbl/SQ/mwFqKTaVTteon/cC7oklag oA0Sbx2GZw4JANVcMR32EL55OYbPibeKKTVPNNq7pCaISdSuMgPYU3Af5IFdk1BMe6vQ O3h2J8dPubspq9uwZiNzDUEt1L35hg6TD+xI9jHLstUnShkKnBJr+shsGCf0UZWUeVDo v/U9mCmrA0BYe3vlhrVXzDEXVRP9DyWj0bVREnifrQqUq7CaTiu+nYQkP3fgXxMsM+q8 q/TjyXeEx/6ZEds7wio7R/AVtlG0nmYTk7kA00J7SHgxhg00iFIEpH3dReS7tdKQ1qTM 6lnA== X-Gm-Message-State: ALKqPwe1hrKF79Y5chLu8B7DmpcJ81xU5DamDvVUaw3LUt2IF5CyBRLz Feklh5mFDVrG9K1N2AuRHGM= X-Google-Smtp-Source: AB8JxZr/dqo1QcH1E2qjavfHaiGzswxyeHRpe36W4g4YvdYCPHbrqLszDvwMi35mTvxxC3u4y/BCGQ== X-Received: by 2002:a50:f30e:: with SMTP id p14-v6mr1436296edm.39.1525946224047; Thu, 10 May 2018 02:57:04 -0700 (PDT) Received: from hollewijn.internal (84-245-13-9.dsl.cambrium.nl. [84.245.13.9]) by smtp.gmail.com with ESMTPSA id o25-v6sm402661edq.62.2018.05.10.02.57.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 10 May 2018 02:57:03 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: ON CONFLICT DO UPDATE From: Alban Hertroys In-Reply-To: Date: Thu, 10 May 2018 11:57:00 +0200 Cc: Adrian Klaver , "pgsql-generallists.postgresql.org" Content-Transfer-Encoding: quoted-printable Message-Id: References: <8c437506-072c-7829-b649-fd2a4a5ecc69@aklaver.com> To: tango ward X-Mailer: Apple Mail (2.3445.6.18) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk > On 10 May 2018, at 7:13, tango ward wrote: > ON CONFLICT (school_system_id, > student_id, > campus_name > ) DO UPDATE > SET school_system_id =3D = excluded.school_system_id, > student_id =3D excluded.student_id, > campus_name =3D excluded.campus_name I'm pretty sure this ought to read: ON CONFLICT (school_system_id, student_id, campus_name) DO UPDATE SET modified =3D EXCLUDED.modified, balance =3D EXCLUDED.balance, balance_as_of =3D EXCLUDED.balance_as_of Instead, you were re-assigning the keys (school_system_id, student_id, = campus_name) to the same values again. Alban Hertroys -- If you can't see the forest for the trees, cut the trees and you'll find there is no forest.