Re: Triggers on Stored Procedures

Поиск
Список
Период
Сортировка
От Kevin Grittner
Тема Re: Triggers on Stored Procedures
Дата
Msg-id 4D1870EB0200002500038BBD@gw.wicourts.gov
обсуждение исходный текст
Ответ на Triggers on Stored Procedures  (Omer Anson <oaanson@gmail.com>)
Список pgsql-admin
Omer Anson <oaanson@gmail.com> wrote:

> First of all, I apologise if I am posting this in the wrong place.

Not a bad place to start, I guess.  If it gets into the realm of an
enhancement request or proposal it might belong on -hackers, but
since you're asking about how it might be done now, this is good.

> I would like to implement aspect-oriented programming in SQL. To
> that end, I figured I need a notification method whenever a stored
> procedure is executed (If possible, with rudimentary filtering).

Well, PostgreSQL doesn't have stored procedures, but it has
functions, which are similar in many respects.

> I have seen that this can be done with triggers for INSERT,
> UPDATE, and DELETE commands, and with RULES  for SELECT commands.
>
> My question is: Is there a way to do this to stored procedures,
> without modifying the stored procedure code?

You could put "pointcut" schemas ahead of "concern" schemas (both
business logic and cross-cutting).  The "join points" would
effectively be the business logic concern functions and the "advice"
would be embodied in the cross-cutting concern functions.  You would
just need to build a tool to create the appropriate pointcut methods
to tie them together as desired, changing the searchpath locally, or
specifying concern function names with schema-qualification.

Of course, you could do the pointcut specification manually, one
method at a time, but that's not very "enterprisy".

-Kevin

В списке pgsql-admin по дате отправления:

Предыдущее
От: Omer Anson
Дата:
Сообщение: Triggers on Stored Procedures
Следующее
От: ℓєѕℓιє ѕαмυєℓ
Дата:
Сообщение: Unable to install 9.0 postgre in debian-lenny