Re: SQL delete and update at the same time - Mailing list pgsql-general

From Michael Lewis
Subject Re: SQL delete and update at the same time
Date
Msg-id CAHOFxGqgZHZVKKWET1ifMNW24QEbX2zyb9yQDQJk0W266nKmow@mail.gmail.com
Whole thread Raw
In response to SQL delete and update at the same time  (<paul.malm@lfv.se>)
Responses SV: SQL delete and update at the same time
List 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.

pgsql-general by date:

Previous
From: "Peter J. Holzer"
Date:
Subject: Re: Persistent Connections
Next
From: "Peter J. Holzer"
Date:
Subject: Re: Persistent Connections