On 1/19/07, Danial Pearce <[EMAIL PROTECTED]> wrote: > On 1/19/07, Jonathan Vanasco <[EMAIL PROTECTED]> wrote: > > VIEWs are great, because they work out essentially as tables -- so > > you can create ROSE DB objects for selecting (though not inserting) > > Sure you can do inserting. You can either do it with postgres > triggers, or you can probably even do it hackily in rose overloading > the save() as a wrapper for calling save() on all the other objects > that your view deals with. Would be hacky and trickery, but not > impossible.
You can do it quite cleanly in PostgreSQL using Rules. The rule system effectively lets you rewrite SQL statements before they are executed. So a single INSERT into a VIEW can be rewritten into multiple INSERT/UPDATE/DELETE statements to multiple different tables. Here is the documentation for the Rule System: http://www.postgresql.org/docs/8.1/static/rules.html And here is the specific info on how to create rules for updating views: http://www.postgresql.org/docs/8.1/static/rules-update.html Note that this is available as far back as version 7.2 so this is not new stuff and should be quite stable and well tested. Cheers, Cees ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Rose-db-object mailing list Rose-db-object@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/rose-db-object