Hello, I have a relatively straight forward set up with two schemas, the main public schema and a private schema (called "testschema" here). The tables in both schemas are nearly identical: for each table "foo" in the public schema, there is a table "testschema._foo" and a view "testschema.foo" in the private schema, where testschema.foo is a simple union of the public and private tables, to make it appear when querying in the private schema that the tables are exactly the same as the public schema, and that the tables have a union of what is in the private and public schemas.
Now, I would like to allow insert, update and delete rules on the private views to do the same actions in private tables (that is, an insert into testschema.foo should really do an insert into testschema._foo). Writing rules to do the update and inserts was fairly straight forward. What I don't understand how to do is a general rule for doing deletes on testschema._foo. What I would like would be a way to "grab" the where clause and append it onto the DO INSTEAD for the rule. I'm thinking something like this: CREATE OR REPLACE RULE testschema_delete_foo AS ON DELETE TO testschema.foo DO INSTEAD (DELETE FROM testschema._foo WHERE $where); So, what I want to know is, is there a "magic" way to get that $where? Thanks, Scott -- ------------------------------------------------------------------------ Scott Cain, Ph. D. scott at scottcain dot net GMOD Coordinator (http://gmod.org/) 216-392-3087 Ontario Institute for Cancer Research -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql