From: | Melvin Davidson <melvin6925(at)gmail(dot)com> |
---|---|
To: | Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com> |
Cc: | Condor <condor(at)stz-bg(dot)com>, "pgsql-generallists(dot)postgresql(dot)org" <pgsql-general(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Need help with trigger |
Date: | 2021-01-23 21:29:26 |
Message-ID: | CANu8FiyfSHd=9dewgCEDG0dUQUUnMQy2fuR6KFtFeOm8jVU8vA@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Maybe this example will help.
From https://www.postgresql.org/docs/current/sql-insert.html
INSERT INTO distributors AS d (did, dname) VALUES (8, 'Anvil Distribution')
ON CONFLICT (did) DO UPDATE
SET dname = EXCLUDED.dname || ' (formerly ' || d.dname || ')'
WHERE d.zipcode <> '21201';
On Sat, Jan 23, 2021 at 3:47 PM Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
wrote:
> On 1/23/21 12:14 PM, Condor wrote:
> > On 23-01-2021 20:49, Adrian Klaver wrote:
> >> On 1/23/21 10:20 AM, Condor wrote:
>
> >
> > Sorry,
> >
> > I'm sorry, I don't understand something. You mean to do pure INSERT ON
> > CONFLICT DO or to modify the trigger ?
>
> No I meant that in the external program you use to fetch the data from
> the other table and reorganize the fields. Do your test there and do
> either the INSERT or UPDATE.
>
>
> --
> Adrian Klaver
> adrian(dot)klaver(at)aklaver(dot)com
>
>
>
--
*Melvin Davidson*
*Maj. Database & Exploration Specialist*
*Universe Exploration Command – UXC*
Employment by invitation only!
From | Date | Subject | |
---|---|---|---|
Next Message | Ron | 2021-01-23 23:27:50 | Question about logically replicating a multi-TB database |
Previous Message | Adrian Klaver | 2021-01-23 20:47:27 | Re: Need help with trigger |