Re: Fwd: [SQL] Start up question about triggers

2006-06-23 Thread Aaron Bono
This is why I was searching for good meta data.Here is a thought.  If your trigger has the OLD and NEW, is there a way to get a list of fields from OLD and NEW?  If TG_RELNAME is the name of the table, could you just ask PostgreSQL what the columns are in that table, iterate through those columns,

Re: Fwd: [SQL] Start up question about triggers

2006-06-23 Thread Tom Lane
Andrew Sullivan <[EMAIL PROTECTED]> writes: > On Fri, Jun 23, 2006 at 06:48:49PM +0300, Forums @ Existanze wrote: >> Then there exist a TG_QUERY parameter that we could use to get the actual >> query ran by a user, so if I ran the imaginary query > Which "actual query"? By the time the trigger fi

Re: Fwd: [SQL] Start up question about triggers

2006-06-23 Thread Andrew Sullivan
On Fri, Jun 23, 2006 at 06:48:49PM +0300, Forums @ Existanze wrote: > > Then there exist a TG_QUERY parameter that we could use to get the actual > query ran by a user, so if I ran the imaginary query Which "actual query"? By the time the trigger fires, the query might already have been rewritte

Re: Fwd: [SQL] Start up question about triggers

2006-06-23 Thread Forums @ Existanze
Hello again, Just a thought! Do any of you know if this is possible? I have a table person CREATE TABLE person( person_id SERIAL PRIMARY KEY, person_name VARCHAR(100) NOT NULL, person_lastname VARCHAR(100) NOT NULL ); And a table audit CREATE TABLE audit( audit

Re: Fwd: [SQL] Start up question about triggers

2006-06-23 Thread Forums @ Existanze
Hello again, First of all thank you all for your effort in helping me solve this problem. George's link seems like a complete auditing framework for a database, so I will look into that, cuase it gives you a complete view of what is going on, and I can have undo opertaions :-) I have to say tha

Re: Fwd: [SQL] Start up question about triggers

2006-06-23 Thread Richard Broersma Jr
> Im really interested in the part where you say "generic trigger" can you > give me some tips? As to how I will go about that? I had already read the > links that Richard gave, I new I could get the values like that. So right > now I will have to create a trigger for each of my tables to create th

Re: Fwd: [SQL] Start up question about triggers

2006-06-23 Thread George Weaver
Hi Fotis, If you end up having to create a solution for each of the 80 tables, you may want to check out the following (may also give you addtional ideas for what you're trying to achieve): http://www.varlena.com/GeneralBits/104.php (Logging Audit Changes with Composite Typed Columns). Reg

Re: Fwd: [SQL] Start up question about triggers

2006-06-23 Thread Forums @ Existanze
Hello again aaron, Im really interested in the part where you say "generic trigger" can you give me some tips? As to how I will go about that? I had already read the links that Richard gave, I new I could get the values like that. So right now I will have to create a trigger for each of my table