Subject | updatable views, joins, read-only views |
---|---|
Author | unordained |
Post date | 2003-04-16T07:19:48Z |
the yahoo groups search on this wasn't particularly useful... so at the expense of seeming redundant: why are views
containing joins not updatable? i can understand (as covered by database theory books) why views with aggregates aren't
updatable, etc. but with simple joins, it'd be awfully handy, for something like this:
create view fix_stuff as select a.correct_value, b.wrong_value from a inner join b on b.a_fk = a.pk /* and other
conditions about b */;
update fix_stuff set b.wrong_value = a.correct_value where 1=1;
(above comment added to note that this isn't just because i felt like violating 3NF in my database)
using sub-selects in update statements seems awfully roundabout (and without indeces, not terribly fast) ... stored
procs seem excessive, and yes, i could just write a quick app to do this via cursors ... but (please don't flame me)
aren't updatable views containing joins considered at least somewhat necessary in a relational database? (within
limits, understandably.)
do you guys have any usual/preferred ways of dealing with this? are views with joins -going- to be updatable in some
future release? (i didn't see it in any of the open or closed bugs, or the open/closed feature requests when i checked
earlier ... maybe i missed it?)
-philip
containing joins not updatable? i can understand (as covered by database theory books) why views with aggregates aren't
updatable, etc. but with simple joins, it'd be awfully handy, for something like this:
create view fix_stuff as select a.correct_value, b.wrong_value from a inner join b on b.a_fk = a.pk /* and other
conditions about b */;
update fix_stuff set b.wrong_value = a.correct_value where 1=1;
(above comment added to note that this isn't just because i felt like violating 3NF in my database)
using sub-selects in update statements seems awfully roundabout (and without indeces, not terribly fast) ... stored
procs seem excessive, and yes, i could just write a quick app to do this via cursors ... but (please don't flame me)
aren't updatable views containing joins considered at least somewhat necessary in a relational database? (within
limits, understandably.)
do you guys have any usual/preferred ways of dealing with this? are views with joins -going- to be updatable in some
future release? (i didn't see it in any of the open or closed bugs, or the open/closed feature requests when i checked
earlier ... maybe i missed it?)
-philip