On Wed, Jul 29, 2009 at 19:53, Brodie
Thiesfield<brofield+pgsql(at)gmail(dot)com> wrote:
> On further investigation, since the logic requires the delete to be
> made first to get rid of other possible rows, so I'll go with:
>
> DELETE
> (if supported) INSERT OR REPLACE
> (otherwise) INSERT, if duplicate key, UPDATE
>
You can use plpgsql to emulate insert or replace (I think there are
some comments on emulating mysql specifically in the commented
versions of the docs somewhere... but thats up to you to find em) see
http://www.postgresql.org/docs/8.4/static/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING
example 38-1