Re: Feature suggestions (long)
От | Zeugswetter Andreas SB SD |
---|---|
Тема | Re: Feature suggestions (long) |
Дата | |
Msg-id | 46C15C39FEB2C44BA555E356FBCD6FA4961FB4@m0114.s-mxs.net обсуждение исходный текст |
Ответ на | Feature suggestions (long) (Martijn van Oosterhout <kleptog@svana.org>) |
Список | pgsql-hackers |
> > What you need is one view that is a union all select selecting all your > > partial tables, all applications only accesses this one view. You need 1 > > insert 2 update 1 delete rule for each table plus 3 remainder rules (=4*N > > + 3 rules) (the select rule is already done by create view), plus one > > check constraint for each partial table. > > WOW! You *are* good. Care to reveal the trick? I can see the insert and > delete rules but what are you doing for the updates? The update needs one for the case where the tuple stays in the same partial table, and the second for moving it to another table. The first is simple (where old.x = new.x), the second must delete the original and insert a new row into the view. The view insert rule handles the distribution (might be, that there are TODO's here, my data stays in place). The additional problem with the second rule is, that the returned UPDATE tag (iirc) does not return the correct number of rows (deleted + inserted rows, see lengthy thread about the return tag). Whether that is an actual problem will depend on your apps. Andreas
В списке pgsql-hackers по дате отправления: