Re: someone working to add merge? - Mailing list pgsql-hackers

From Tom Lane
Subject Re: someone working to add merge?
Date
Msg-id 20083.1131730779@sss.pgh.pa.us
Whole thread Raw
In response to Re: someone working to add merge?  (Josh Berkus <josh@agliodbs.com>)
Responses Re: someone working to add merge?  (Peter Eisentraut <peter_e@gmx.net>)
List pgsql-hackers
Josh Berkus <josh@agliodbs.com> writes:
> Funny, we were just discussing this at OpenDBCon.   Seems that you can't do a
> full implementation of MERGE without Predicate Locking (the ability to say 
> "lock this table against inserts or updates of any row with key=5").  
> However, Peter suggested that we could do a proof-of-concept implementation, 
> working out syntax and trigger issues, based on a full table lock and do the 
> hard work once it was proved to be feasable.

If you don't have any better idea how to do it than a full table lock,
you might as well not do it at all.  A "proof of concept" that doesn't
solve the hard part of the problem is no proof :-(

My first guess about a real implementation would involve extending the
index AM API to offer a function "insert this key, or return the
existing match if there already is one".  This might tie into
refactoring the existing implementation of unique indexes, in which all
the problem is put on the AM's head (which is why only btree copes at
the moment).
        regards, tom lane


pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: someone working to add merge?
Next
From: Tom Lane
Date:
Subject: Re: 8.1 substring bug?