Re: SQL delete and update at the same time

From: Michael Lewis <mlewis(at)entrata(dot)com>
To: paul(dot)malm(at)lfv(dot)se
Cc: PostgreSQL General <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: SQL delete and update at the same time
Date: 2020-06-24 19:32:52
Message-ID: CAHOFxGqgZHZVKKWET1ifMNW24QEbX2zyb9yQDQJk0W266nKmow@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

>
> But how can I set the edited vale = 1 on the objects (line segments) that
> are not deleted (in the current buffer) at the same time so it won’t be
> deleted in the next run with an adjacent buffer?
>

You might want to create a temporary table to hold unique identifiers of
all records that you want to either delete or edit, and make use of a
RETURNING clause to determine which got deleted, then update the records
NOT IN that returning clause values (or use EXCEPT). Perhaps that would get
you where you want to end up.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Peter J. Holzer 2020-06-24 19:36:05 Re: Persistent Connections
Previous Message Peter J. Holzer 2020-06-24 19:10:14 Re: Persistent Connections