Re: ON CONFLICT DO UPDATE

From: Alban Hertroys <haramrae(at)gmail(dot)com>
To: tango ward <tangoward15(at)gmail(dot)com>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: ON CONFLICT DO UPDATE
Date: 2018-05-10 09:57:00
Message-ID: DF8A2622-3434-464D-A385-33A0BBA81095@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general


> On 10 May 2018, at 7:13, tango ward <tangoward15(at)gmail(dot)com> wrote:

> ON CONFLICT (school_system_id,
> student_id,
> campus_name
> ) DO UPDATE
> SET school_system_id = excluded.school_system_id,
> student_id = excluded.student_id,
> campus_name = excluded.campus_name

I'm pretty sure this ought to read:
ON CONFLICT (school_system_id, student_id, campus_name)
DO
UPDATE SET modified = EXCLUDED.modified,
balance = EXCLUDED.balance,
balance_as_of = 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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message tango ward 2018-05-10 10:04:41 Re: ON CONFLICT DO UPDATE
Previous Message Francisco Olarte 2018-05-10 08:59:34 Re: Domain based on TIMEZONE WITH TIME ZONE