My approach was to have a view that is accessed by the normal users and have the admin access the table directly. However, it doesn't appear that I can actually apply a trigger to a view.
Some of this I can do with rules on the view, but certain restrictions are applicable only on a row-by-row basis, so I think I need to do it in a BEFORE trigger.
Is there a way I can either:
1. Apply a trigger to a view. The trigger would actually get registered with the underlying table, but would only be invoked if the user had entered via the view.
2. Detect inside the trigger function whether the user had accessed the table directly or through the view so I could invoke conditional code accordingly.
I want to avoid hardcoding user ID's in the trigger, so I'm trying to take this approach so it can all be handled simply by granting privileges on different views to enable/disable the varying levels of restriction.
Any ideas?
Kyle Bateman
---------------------------(end of broadcast)--------------------------- TIP 9: the planner will ignore your desire to choose an index scan if your joining column's datatypes do not match