Thread: Automatically Creating INSERT/UPDATE/DELETE Rules on Views

Automatically Creating INSERT/UPDATE/DELETE Rules on Views

From
"Matt Miller"
Date:
I'm converting a large Oracle DB that uses hundreds of updatable views.
ora2pg is quite useful, but it looks like it doesn't do anything to
create the rules that are needed to make the views updatable.  Under
Oracle simple views like "select * from the_table" are automatically
updatable, so the Oracle schema doesn't have any triggers or the like
that I could import as PG rules.

Any suggestions?

Re: Automatically Creating INSERT/UPDATE/DELETE Rules on Views

From
Robert Treat
Date:
On Friday 10 November 2006 18:39, Matt Miller wrote:
> I'm converting a large Oracle DB that uses hundreds of updatable views.
> ora2pg is quite useful, but it looks like it doesn't do anything to
> create the rules that are needed to make the views updatable.  Under
> Oracle simple views like "select * from the_table" are automatically
> updatable, so the Oracle schema doesn't have any triggers or the like
> that I could import as PG rules.
>

You might be able to use the information in pg_depend to write a script to
generate the rules for any view that only has a single table in it's
dependency tree.  (I've really no idea if this would work, so if you try it
and it succeeds please post a note or some code back to the group!)

--
Robert Treat
Build A Brighter LAMP :: Linux Apache {middleware} PostgreSQL