pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kevin Grittner <Kevin.Grittner@wicourts.gov>
To: Omer Anson <oaanson@gmail.com>
To: pgsql-admin@postgresql.org
Subject: Re: Triggers on Stored Procedures
Date: Mon, 27 Dec 2010 10:56:43 -0600
Message-ID: <4D1870EB0200002500038BBD@gw.wicourts.gov> (raw)
In-Reply-To: <AANLkTinDq6GoWO_=FuihMqOx6JBA7c2JN5PPfoPwNKE4@mail.gmail.com>
References: <AANLkTinDq6GoWO_=FuihMqOx6JBA7c2JN5PPfoPwNKE4@mail.gmail.com>

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



view thread (3+ messages)  latest in thread

Message-ID: <4D1870EB0200002500038BBD@gw.wicourts.gov>
Permalink:  ../4D1870EB0200002500038BBD@gw.wicourts.gov/
Also on:    postgresql.org/message-id/4D1870EB0200002500038BBD@gw.wicourts.gov

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: Kevin.Grittner@wicourts.gov, oaanson@gmail.com
  Subject: Re: Triggers on Stored Procedures
  In-Reply-To: <4D1870EB0200002500038BBD@gw.wicourts.gov>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox