From: | Csaba Nagy <nagy(at)ecircle-ag(dot)com> |
---|---|
To: | Jaime Casanova <systemguards(at)gmail(dot)com> |
Cc: | Josh Berkus <josh(at)agliodbs(dot)com>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: someone working to add merge? |
Date: | 2005-11-11 17:31:32 |
Message-ID: | 1131730292.8979.93.camel@coppola.muc.ecircle.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Fri, 2005-11-11 at 18:15, Jaime Casanova wrote:
> On 11/11/05, Josh Berkus <josh(at)agliodbs(dot)com> wrote:
> > Jaime,
> >
> > > so i suppose we can reuse many of the code breaking the merge in 3
> > > pieces... for now they are just thougths, i will think more in this
> > > and try to implement it...
> > >
> > > comments? ideas? suggestions?
> >
> > 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").
>
> it isn't what select for update does?
Select for update only works if the row is already there. If there's no
row, you can't lock it. So you want then to insert it, but then it is
possible that somebody inserted it before you, immediately after your
update... so the solution would be more like:
- try insert;
- if insert fails, do update;
You can already do that, but you have to place a save-point before the
insert, so you can continue your transaction even if the insert fails.
Without knowledge of postgres internals, the simplest would be to be
able to do the "continue transaction if insert fails" with the cheapest
prise to pay. This would mean wrap up existing code, except that
"continue transaction after failure of insert" part.
All this might be completely bull*it of course, I don't know too much
about postgres internals.
[snip]
Cheers,
Csaba.
From | Date | Subject | |
---|---|---|---|
Next Message | Brusser, Michael | 2005-11-11 17:35:28 | How to find a number of connections |
Previous Message | Stephan Szabo | 2005-11-11 17:30:47 | Re: 8.1 substring bug? |