Re: most idiomatic way to "update or insert"? - Mailing list pgsql-general

From Greg Stark
Subject Re: most idiomatic way to "update or insert"?
Date
Msg-id 878ycujr0g.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: most idiomatic way to "update or insert"?  ("Peter Darley" <pdarley@kinesis-cem.com>)
List pgsql-general
I'll mention that often I do exactly what you're doing. I find deleting all
existing records and then inserting what I want to appear to be cleaner than
handling the various cases that can arise if you don't.

This happens most often when I have a list of items and have a UI that allows
the user to edit the entire list and commit a whole new list in one action.
It's much easier to simply delete the old list and insert the entire new list
in a single query than to try to figure out which rows to delete and which to
insert.

--
greg

pgsql-general by date:

Previous
From: Steve Crawford
Date:
Subject: Re: query result set caching
Next
From: Lincoln Yeoh
Date:
Subject: Re: most idiomatic way to "update or insert"?