|Subject:||Impossible to create writable views via triggers|
|X-Mailer:||MIME-tools 5.427 (Entity 5.427)|
(copied from, in hopes it gets more attention.) Writable views could be implemented via triggers, except that the 'on_table' parameter to SQL::Translator::Schema::Trigger->new() wants a real table ("Table named visits_expanded doesn't exist at ...SQL/Translator/Schema/Trigger.pm line 237"). However, in PostgreSQL, adding a trigger to a view is perfectly legal, and the correct way of making a writable view: CREATE OR REPLACE RULE mytable_expanded_update AS ON UPDATE TO mytable_expanded DO INSTEAD UPDATE mytable SET comment = new.comment WHERE mytable.id = new.id The view was created earlier in the code: my $view_writable = SQL::Translator::Schema::View->new( name => 'mytable_expanded', sql => 'SELECT ... ' ) Would be great if triggers could be added to views as well.