Re: inserting to a multi-table view
От | Michael Shulman |
---|---|
Тема | Re: inserting to a multi-table view |
Дата | |
Msg-id | c3f821000806171234w37963edaheff9d468cb2b2853@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: inserting to a multi-table view ("Richard Broersma" <richard.broersma@gmail.com>) |
Ответы |
Re: inserting to a multi-table view
|
Список | pgsql-general |
On Tue, Jun 17, 2008 at 11:50 AM, Richard Broersma <richard.broersma@gmail.com> wrote: > While your individual update rules are firing for each of your tables > from T1 thru T[n] to change your OLD row to NEW. Another client could > also at the same time be updating any of the other tables before and > after your update Rules take affect. The net result is that, some of > what you've changed could over write what the other client commited. > And some of what you've commited could be over written by what the > other client wrote. The end result is that the view's virtual "row" > appears to be left in an inconsistant state. Got it; thanks. > Basically what you want to achieve is something like: > > begin: > Select for update table T1 where id = old.id; > Select for update table T2 where id = old.id; > Select for update table (...) where id = old.id; > Select for update table T[n-1] where id = old.id; > Select for update table T[n] where id = old.id; > if all the needed row lock are aquired, then > begin the updates > else rollback > commit; Would it be possible to actually do something like this in an update rule? You couldn't write the "begin/commit", but it seems that you wouldn't need to either, since the UPDATE command invoking the rule will be wrapped in its own begin/commit (automatic or explicit). Mike
В списке pgsql-general по дате отправления: