Reputation: 51
Sometimes I need to copy/rename tables. My client is doing that work just fine, with one exception: new table's rules still contain references to old table.
Is there any way to not editing such rules? I'd prefer some keyword instead the table name, referencing to table, which the rule is triggered on...
Upvotes: 0
Views: 155
Reputation: 26464
there is no easy way to do this with RULE
s, but triggers provide this functionality, and in fact you can re-use trigger
functions across tables.
This is one area where you will find triggers to be much more useful than rules.
Within a trigger, you can use TG_RELNAME
for the current table name. Unfortunately such is not available within the RULE
system however.
Upvotes: 1