Delete rules

Поиск
Список
Период
Сортировка
Искать

Delete rules

От:
"Little, Douglas" <DOUGLAS.LITTLE@orbitz.com>
Дата:

Hi,

We’d like to give our applications truncate capability, but that would also give them drop table permission, which we don’t want them to have.

So, we created a truncate function that uses the definers security context.

 

The issue is that we now have 1000’s of programs to change to use the function.  A task the developers don’t want to do.

 

So,  we’re investigating using a DELETE rule.  I’d like to be able to rewrite   an unqualified delete into a the call to the truncate function otherwise, leave it alone.

 

But I don’t know how to access the entire sql statement for interrogation.  

Is there a way I can see what the statement is that’s executing and triggering the rule?

 

Thanks

 

 

Doug Little

 

Sr. Data Warehouse Architect | Enterprise Data Management | Orbitz Worldwide

500 W. Madison, Suite 1000  Chicago IL 60661| Office 312.260.2588 | Fax 312.894.5164 | Cell 847-997-5741

Douglas.Little@orbitz.com

   orbitz.com | ebookers.com | hotelclub.com | cheaptickets.com | ratestogo.com | asiahotels.com

 

Re: Delete rules

От:
Richard Broersma <richard.broersma@gmail.com>
Дата:
On Wed, Aug 4, 2010 at 1:25 PM, Little, Douglas <DOUGLAS.LITTLE@orbitz.com> wrote:
 

But I don’t know how to access the entire sql statement for interrogation.   Is there a way I can see what the statement is that’s executing and triggering the rule?


I've found complex and simple rules pretty hard to get correct.  They sometimes do unexpected things.

It looks like the CREATE Trigger  FOR EACH STATEMENT is better suited to do what you want:

"In addition, triggers may be defined to fire for a TRUNCATE, though only FOR EACH STATEMENT."

--
Regards,
Richard Broersma Jr.

Visit the Los Angeles PostgreSQL Users Group (LAPUG)
http://pugs.postgresql.org/lapug
FAQ