[SQL] Triggers on system tables

2010-03-03 Thread Gianvito Pio
Hi all, is there a way (also strange) to define a trigger on a system table (for example on pg_class)? I tried but I got (as expected) a permission denied message... Thanks

Re: [SQL] Triggers on system tables

2010-03-03 Thread Andreas Kretschmer
Gianvito Pio pio.gianv...@gmail.com wrote: Hi all, is there a way (also strange) to define a trigger on a system table (for example on pg_class)? No. Andreas -- Really, I'm not out to destroy Microsoft. That will just be a completely unintentional side effect.

Re: [SQL] triggers order

2008-04-18 Thread A. Kretschmer
am Fri, dem 18.04.2008, um 11:44:12 +0200 mailte Marcin Krawczyk folgendes: Hi all. Today my question is about the order triggers are fired on a table. Is there a way to determine that order? Or what interests me even more, can I alphabetical. Andreas -- Andreas Kretschmer Kontakt:

[SQL] triggers order

2008-04-18 Thread Marcin Krawczyk
Hi all. Today my question is about the order triggers are fired on a table. Is there a way to determine that order? Or what interests me even more, can I adjust the order triggers are fired? Regards mk

Re: [SQL] triggers order

2008-04-18 Thread Marcin Krawczyk
Thanks for a fast answer. Frankly I was hoping it would be alphabetical ;) regards mk 2008/4/18, A. Kretschmer [EMAIL PROTECTED]: am Fri, dem 18.04.2008, um 11:44:12 +0200 mailte Marcin Krawczyk folgendes: Hi all. Today my question is about the order triggers are fired on a table. Is

Re: [SQL] TRIGGERS and FUNCTIONS

2007-08-20 Thread Richard Broersma Jr
--- ashok raj [EMAIL PROTECTED] wrote: Hello All , I am having a table named test with a trigger tri_test which triggers the function replicate() on insert, update and delete . Can I able to get the SQL STATEMENT which triggers the function

[SQL] TRIGGERS and FUNCTIONS

2007-08-19 Thread ashok raj
Hello All , I am having a table named test with a trigger tri_test which triggers the function replicate() on insert, update and delete . Can I able to get the SQL STATEMENT which triggers the function replicate ( ) , inside the function definition

Re: [SQL] Triggers

2006-08-22 Thread Kis János Tamás
Hi, Plesae read my previous message in this mail list, on 2006-08-15. 14.20 at [SQL] Undo an update thread. bye, kjt McAfee SCM 4.1 által ellenőrizve! ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate

[SQL] Triggers

2006-08-21 Thread Ezequias Rodrigues da Rocha
Hi list, I am planning to generate a trigger to each [update or delete or insert] on my database to register all moviment on my base (current_user, when, action, user). I notice that the trigger is able put a procedure in action but as I have more than 20 tables I would like to use only one

Re: [SQL] Triggers

2006-08-21 Thread Kaloyan Iliev
Hi, You can use one procedure(function in Postgres) but you have to use 26 triggers. Every trigger can call this one procedure to record the information you want. Regards, Kaloyan Iliev Ezequias Rodrigues da Rocha wrote: Hi list, I am planning to generate a trigger to each [update or

Re: [SQL] Triggers using PL/pgSQL

2006-07-31 Thread John DeSoi
Is it really necessary to build a SQL string and use execute? It seems you could just issue the INSERT statement. On Jul 31, 2006, at 12:52 AM, Aaron Bono wrote: CREATE OR REPLACE FUNCTION my_table_history_fn () RETURNS SETOF opaque AS ' BEGIN -- if a trigger insert or update

Re: [SQL] Triggers using PL/pgSQL

2006-07-31 Thread Aaron Bono
On 7/31/06, John DeSoi [EMAIL PROTECTED] wrote: Is it really necessary to build a SQL string and use execute? Itseems you could just issue the INSERT statement.I don't think so but there was some discussion a week or two ago about mixing variables and using execute. I am curious, does anyone know

Re: [SQL] Triggers using PL/pgSQL

2006-07-31 Thread John DeSoi
On Jul 31, 2006, at 10:59 AM, Aaron Bono wrote: On 7/31/06, John DeSoi [EMAIL PROTECTED] wrote: Is it really necessary to build a SQL string and use execute? It seems you could just issue the INSERT statement. I don't think so but there was some discussion a week or two ago about mixing

Re: [SQL] Triggers using PL/pgSQL

2006-07-31 Thread Ken Hill
On Sun, 2006-07-30 at 21:16 -0700, Thusitha Kodikara wrote: Hello, I am interested in developing some triggers to keep track of records that are changed (possibly the changes of one or more specific columns). In addition to keeping the new values, I also need to keep the old values (may be

Re: [SQL] Triggers using PL/pgSQL

2006-07-31 Thread Milen A. Radev
Thusitha Kodikara написа: Hello, I am interested in developing some triggers to keep track of records that are changed (possibly the changes of one or more specific columns). In addition to keeping the new values, I also need to keep the old values (may be on a separate table).

Re: [SQL] Triggers using PL/pgSQL

2006-07-31 Thread George Weaver
- Original Message - From: Aaron Bono To: John DeSoi snip I don't think so but there was some discussion a week or two ago about mixing variables and using execute. I am curious, does anyone know what the best approach is? Also, I did not address deletions. If you still need to

[SQL] Triggers using PL/pgSQL

2006-07-30 Thread Thusitha Kodikara
Hello,I am interested in developing some triggers to keep track of records that are changed (possibly the changes of one or more specific columns). In addition to keeping the new values, I also need to keep the old values (may be on a separate table). Though I have done similar things in other

Re: [SQL] Triggers using PL/pgSQL

2006-07-30 Thread Aaron Bono
On 7/30/06, Thusitha Kodikara [EMAIL PROTECTED] wrote: Hello,I am interested in developing some triggers to keep track of records that are changed (possibly the changes of one or more specific columns). In addition to keeping the new values, I also need to keep the old values (may be on a separate

Re: [SQL] Triggers using PL/pgSQL

2006-07-30 Thread Thusitha Kodikara
Hello,Thanks a lot Aaron for the very quick and simple example. I just checked it on 7.4.5 also and it worked. I'll be able to continue with my development using the syntax of that example.Regards,-ThusithaAaron Bono [EMAIL PROTECTED] wrote: On 7/30/06, Thusitha Kodikara [EMAIL PROTECTED] wrote:

Re: [SQL] Triggers using PL/pgSQL

2006-07-30 Thread Aaron Bono
No problem. I have been meaning to put the same code together for myself but have been putting it off. It gave me an excuse to stop procrastinating.On 7/31/06, Thusitha Kodikara [EMAIL PROTECTED] wrote: Hello,Thanks a lot Aaron for the very quick and simple example. I just checked it on 7.4.5 also

Re: [SQL] Triggers

2005-11-29 Thread Jan Wieck
On 11/23/2005 3:44 AM, Achilleus Mantzios wrote: O Neil Saunders έγραψε στις Nov 22, 2005 : And change AFER INSERT to BEFORE INSERT 1) it doesnt make any difference since we are updating a different table than the trigger's one In this particular case it doesn't. In general, another

[SQL] Triggers

2005-11-22 Thread Leif B. Kristensen
I'm trying to understand triggers. I have read the documentation in the manual as well as the few pages in the Douglas book about the subject, but I don't see how to implement a trigger that simply updates a 'last_edit' date field in my 'persons' table whenever I do an insert or update into my

Re: [SQL] Triggers

2005-11-22 Thread Achilleus Mantzios
O Leif B. Kristensen έγραψε στις Nov 22, 2005 : I'm trying to understand triggers. I have read the documentation in the manual as well as the few pages in the Douglas book about the subject, but I don't see how to implement a trigger that simply updates a 'last_edit' date field in my

Re: [SQL] Triggers

2005-11-22 Thread Achilleus Mantzios
O Leif B. Kristensen έγραψε στις Nov 22, 2005 : On Tuesday 22 November 2005 17:25, Achilleus Mantzios wrote: O Leif B. Kristensen έγραψε στις Nov 22, 2005 : I'm trying to understand triggers. I have read the documentation in the manual as well as the few pages in the Douglas book about the

Re: [SQL] Triggers

2005-11-22 Thread Neil Saunders
Try: create or replace function update_last_edit() returns trigger as $$ begin new.last_edit=now(); return new; end; $$ language plpgsql; On 11/22/05, Leif B. Kristensen [EMAIL PROTECTED] wrote: On Tuesday 22 November 2005 17:25, Achilleus Mantzios wrote: O Leif B. Kristensen έγραψε στις Nov

Re: [SQL] Triggers

2005-11-22 Thread Neil Saunders
And change AFER INSERT to BEFORE INSERT On 11/22/05, Achilleus Mantzios [EMAIL PROTECTED] wrote: O Leif B. Kristensen έγραψε στις Nov 22, 2005 : On Tuesday 22 November 2005 17:25, Achilleus Mantzios wrote: O Leif B. Kristensen έγραψε στις Nov 22, 2005 : I'm trying to understand triggers.

Re: [SQL] Triggers

2005-11-22 Thread Leif B. Kristensen
On Tuesday 22 November 2005 18:07, Achilleus Mantzios wrote: O Leif B. Kristensen ?? Nov 22, 2005 : What am I missing? apparently some forgotten process_last_edited() function. Yes -- an earlier attempt at the same thing ... I finally managed to create my first trigger: CREATE OR

Re: [SQL] Triggers

2005-11-22 Thread Achilleus Mantzios
O Neil Saunders έγραψε στις Nov 22, 2005 : And change AFER INSERT to BEFORE INSERT 1) it doesnt make any difference since we are updating a different table than the trigger's one 2) Your email text comes really garbled -- -Achilleus ---(end of

[SQL] Triggers Conditional Assignment

2005-09-15 Thread Neil Saunders
Hi, I've run in to a small problem when writing a trigger. For simplicities sake lets say that I have 2 tables – 'bookings' and 'unavailable_periods'. Both have columns 'start_date','end_date', and 'property_id'. I have written a trigger that is fired on inserts and updates for both tables that

Re: [SQL] Triggers Conditional Assignment

2005-09-15 Thread Gnanavel S
coalesce(NEW.end_date , OLD.end_date) will solve the issue.On 9/15/05, Neil Saunders [EMAIL PROTECTED] wrote:Hi,I've run in to a small problem when writing a trigger. For simplicities sake lets say that I have 2 tables – 'bookings' and'unavailable_periods'. Both have columns

Re: [SQL] Triggers Conditional Assignment

2005-09-15 Thread Tom Lane
Neil Saunders [EMAIL PROTECTED] writes: I've tried to write something along the lines of the following: sdate = (NEW.start_date IS NOT NULL) ? NEW.start_date : OLD.start_date; edate = (NEW.end_date IS NOT NULL) ? NEW.end_date : OLD.end_date; But conditional assignment doesn't seem to

[SQL] Postgresql FK to MS SQL triggers

2005-03-01 Thread Igor Kryltsov
Hi, If you are moving from Postgres to MS SQL you will most likely will find that you can not recreate your PostgreSQL FK to MSSQL FK because this enterprise class database will NOT allow you to create all 3 FK which are exist in your PGSQL: table users(user_id PK) table journal(created_by,

[SQL] triggers

2005-02-14 Thread AL� �EL�K
update trigger working on same table??? ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

Re: [SQL] triggers

2005-02-14 Thread Michael Fuhr
On Mon, Feb 14, 2005 at 05:42:27PM +0200, ALÝ ÇELÝK wrote: update trigger working on same table??? Could you be more specific, please? What are you trying to do? -- Michael Fuhr http://www.fuhr.org/~mfuhr/ ---(end of broadcast)--- TIP 8:

Re: [SQL] triggers

2005-02-14 Thread PFC
update trigger working on same table??? If an UPDATE trigger does an update on its own table, it can trigger itself and explode... ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send an appropriate

Re: [SQL] Triggers - need help !!!

2004-07-09 Thread Mischa Sandberg
Richard Huxton [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Pradeepkumar, Pyatalo (IE10) wrote: IF UPDATE(CreateTime) THEN END IF; Is this syntax correct. No, and I don't recall seeing anything like it in the manuals. ... and it's always an excellent time to

[SQL] Triggers - need help !!!

2004-07-07 Thread Pradeepkumar, Pyatalo (IE10)
Hi, I am writing some triggers for my project. I am writing a trigger on a table after deleteI want to know how u refer to the row that is being deleted. For example for a trigger function after INSERT/UPDATE u refer to the row being inserted/updated using NEW like this CREATE FUNCTION

Re: [SQL] Triggers

2004-06-09 Thread Richard Huxton
Philip J. Boonzaaier wrote: The technical reference gives an example of a trigger on a table - employee Just to test this, I have created the following table, CREATE TABLE employee (name VARCHAR(30), age int4, state VARCHAR(2), manager VARCHAR(3), adult VARCHAR(3)); The I created a simple

[SQL] triggers on commit

2004-03-19 Thread Erik Thiele
Hi! I am having a probably stupid question, but anyway I can't find it's solution. it should be a novice question, but lets see :)) I have 2 tables. calendar: person_id INTEGER when DATE type TEXT holiday: person_id INTEGER assigned_to DATE last_possible_assignment DATE the idea

Re: [SQL] triggers on commit

2004-03-19 Thread Tom Lane
Erik Thiele [EMAIL PROTECTED] writes: now. what i wanted to do is ensure that this is done correctly and otherwise abort the transaction. of course this check needs to be done at the commit time, because if i do it on statement level, it cannot work, since i cannot change two tables at the

Re: [SQL] triggers on commit

2004-03-19 Thread Erik Thiele
On Fri, 19 Mar 2004 10:13:56 -0500 Tom Lane [EMAIL PROTECTED] wrote: Erik Thiele [EMAIL PROTECTED] writes: now. what i wanted to do is ensure that this is done correctly and otherwise abort the transaction. of course this check needs to be done at the commit time, because if i do it on

Re: [SQL] Triggers

2004-03-05 Thread Jonathan M. Gardner
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On Thursday 26 February 2004 2:18 am, Philip J. Boonzaaier wrote: The technical reference gives an example of a trigger on a table - employee Just to test this, I have created the following table, CREATE TABLE employee (name VARCHAR(30), age

[SQL] Triggers

2004-02-29 Thread Philip J. Boonzaaier
The technical reference gives an example of a trigger on a table - employee Just to test this, I have created the following table, CREATE TABLE employee (name VARCHAR(30), age int4, state VARCHAR(2), manager VARCHAR(3), adult VARCHAR(3)); The I created a simple Function, as follows : CREATE

Re: [SQL] Triggers

2004-01-18 Thread Benoît BOURNON
I try pgmail and that is well running ... fo security, do not use attachment files with your mail ... try pgmail, you need to use pl/tclu ... Ben Sai Hertz And Control Systems wrote: Dear Uzo , Hi, does postgresql support the ability to email as in SQL Server? I want to create a trigger

Re: [SQL] Triggers

2004-01-13 Thread BenLaKnet
I try pgmail and that is well running ... fo security, do not use attachment files with your mail ... try pgmail, you need to use pl/tclu ... Ben Sai Hertz And Control Systems wrote: Dear Uzo , Hi, does postgresql support the ability to email as in SQL Server? I want to

[SQL] Triggers

2004-01-12 Thread beyaRecords - The home Urban music
Hi, does postgresql support the ability to email as in SQL Server? I want to create a trigger which on input of a record will send out an email. Is this possible? Uzo ---(end of broadcast)--- TIP 3: if posting/reading through Usenet, please send

Re: [SQL] Triggers

2004-01-12 Thread Peter Eisentraut
beyaRecords - The home Urban music wrote: does postgresql support the ability to email as in SQL Server? I want to create a trigger which on input of a record will send out an email. Is this possible? Write a trigger function in, say, PL/PerlU or PL/sh and have it send the email with the

Re: [SQL] Triggers

2004-01-12 Thread Sai Hertz And Control Systems
Dear Uzo , Hi, does postgresql support the ability to email as in SQL Server? I want to create a trigger which on input of a record will send out an email. Is this possible? http://pgmail.sourceforge.net/ is what you need. Regards, Vishal Kashyap ---(end of

Re: [SQL] Triggers

2004-01-12 Thread Richard Huxton
On Monday 12 January 2004 16:14, beyaRecords - The home Urban music wrote: Hi, does postgresql support the ability to email as in SQL Server? I want to create a trigger which on input of a record will send out an email. Is this possible? Have a look in the mailing list archives - this has

[SQL] Triggers Help...

2003-09-17 Thread tiagoalves
Hi, I have two databases with the same tables, one is my Real Database and the other is my Log Database. My Log database does NOT have any kind of keys (PRIMARY or FOREIGN). I need to insert from my Real database to my Log database every row that is Updated or Deleted in any Table of the Real

Re: [SQL] Triggers Help...

2003-09-17 Thread Gaetano Mendola
[EMAIL PROTECTED] wrote: Hi, I have two databases with the same tables, one is my Real Database and the other is my Log Database. My Log database does NOT have any kind of keys (PRIMARY or FOREIGN). I need to insert from my Real database to my Log database every row that is Updated or Deleted

Re: [SQL] triggers

2002-10-18 Thread Bruce Momjian
Stian Riis wrote: Hi. Does anyone know if it is posible to make a trigger that execute an external program ? I want to execute a another program on the server when I get a row in one of my tables... Yes, you can use plperl and call an external program from there, or us plsh and run it that

Re: [SQL] triggers

2002-10-11 Thread Richard Huxton
On Friday 11 Oct 2002 2:48 pm, Stian Riis wrote: Hi. Does anyone know if it is posible to make a trigger that execute an external program ? I want to execute a another program on the server when I get a row in one of my tables... The customary way is to have a helper process that sits there

Re: [SQL] triggers

2002-10-11 Thread Achilleus Mantzios
On Fri, 11 Oct 2002, Richard Huxton wrote: The customary way is to have a helper process that sits there LISTENing for a NOTICE and then calls the external program as required. Cleaner and means the other program doesn't have any direct connection to the Postgresql backend. - Richard

Re: [SQL] triggers and plpgsql question

2002-08-28 Thread Mathieu Arnold
--On mardi 27 août 2002 15:38 -0700 Josh Berkus [EMAIL PROTECTED] wrote: Mathieu, The thing I need, is to be able to know what does NEW contains, and I have not found out any mean to do so. If it's not possible to do so, I'll write a function per table, but for the beauty of all this,

Re: [SQL] triggers and plpgsql question

2002-08-28 Thread Mathieu Arnold
--On mercredi 28 août 2002 08:42 +0200 Mathieu Arnold [EMAIL PROTECTED] wrote: --On mardi 27 août 2002 15:38 -0700 Josh Berkus [EMAIL PROTECTED] wrote: Mathieu, The thing I need, is to be able to know what does NEW contains, and I have not found out any mean to do so. If it's not

[SQL] triggers and plpgsql question

2002-08-27 Thread Mathieu Arnold
Hi I want to do a generic function that I can add to triggers to add every inserts, updates and deletes from many differents tables into a common format in another table. the idea is : create function do_it_all () returns opaque ' begin IF TG_OP = ''INSERT'' THEN cycle through all of NEW

Re: [SQL] triggers and plpgsql question

2002-08-27 Thread Josh Berkus
Mathieu, The thing I need, is to be able to know what does NEW contains, and I have not found out any mean to do so. If it's not possible to do so, I'll write a function per table, but for the beauty of all this, I would have liked to do it the way above. You can't do this in PL/pgSQL.

Re: [SQL] Triggers for inserting on VIEWS

2002-08-03 Thread Josh Berkus
Marc, at least with PostgreSQL 7.1 it was possible to create a trigger on a view. 7.2 seems to fail with: psql:t:25: ERROR: CreateTrigger: relation egg_view is not a table is there any replacement so that inserting somewhere acts on multiple tables ? Yes. Use the RULES system,

Re: [SQL] Triggers for inserting on VIEWS

2002-08-03 Thread Tom Lane
Marc SCHAEFER [EMAIL PROTECTED] writes: at least with PostgreSQL 7.1 it was possible to create a trigger on a view. Use a rule instead. 7.2 will reject an attempt to insert into a view without a replacement rule, so a trigger would do you no good anyhow. (I thought that behavior went back

Re: [SQL] Triggers for inserting on VIEWS

2002-08-03 Thread Marc SCHAEFER
On Sat, 3 Aug 2002, Marc SCHAEFER wrote: is there any replacement so that inserting somewhere acts on multiple tables ? Thanks for the suggestion to use RULES. My solution (comments welcome): DROP RULE r_entree_rapide_ecriture_insert; DROP FUNCTION f_entree_rapide_ecriture_insert(TEXT,

Re: [SQL] Triggers do not fire

2001-10-17 Thread Reiner Dassing
Hello Tom! Thank you for your help! Your hints did solve the asked problem. The update trigger is fired if there is a row in the table test to be updated. But, behind my question there was another design (philosophie) which I am trying to solve by the means of different triggers. This is off

Re: [SQL] Triggers do not fire

2001-10-17 Thread Jason Earl
I can vouch for that. I have several tables with 10 to 16 million entries in much the same sort of setup as you are describing (primary key, timestamp, value). PostgreSQL is will quite happily use the timestamp indexes when accessing this table, and it doesn't default to a sequential scan until

[SQL] Triggers do not fire

2001-10-16 Thread Reiner Dassing
Hallo! I have written a very small test procedure to show a possible error on PostgreSQL V7.1.1. A trigger does not fire the function on update but on inserts. Does someone have made the same experiences? Here is the short example which is doing nothing important, just showing the situation:

Re: [SQL] Triggers do not fire

2001-10-16 Thread Tom Lane
Reiner Dassing [EMAIL PROTECTED] writes: I have written a very small test procedure to show a possible error on PostgreSQL V7.1.1. The error is yours: you set up the trigger function to return NULL, which means it's telling the system not to allow the INSERT or UPDATE. INSERT INTO test

Re: [SQL] Triggers do not fire

2001-10-16 Thread Aasmund Midttun Godal
Your update trigger is fired FOR EACH ROW and no rows are updated i.e. no trigger fired! On Tue, 16 Oct 2001 14:48:59 +0200, Reiner Dassing [EMAIL PROTECTED] wrote: Hallo! I have written a very small test procedure to show a possible error on PostgreSQL V7.1.1. A trigger does not fire the

[SQL] Triggers in 7.0.x and SQL syntax.

2001-05-28 Thread D0
Well, after dinking around for serveral hours I decided to beg for help on here about triggers and look like an idiot all in one slew. I have two tables. A and B. Whenever A has a row inserted I want to grab that newly created primary key from it's row in table A and insert it into a field in

[SQL] Triggers on SELECT

2001-04-12 Thread Lonnie Cumberland
Hello All, I have been reading on the uses of the Triggers from within the PL/pgSQL language and have seen that you can set up triggers for such things as UPDATE, and INSERT. I was just wondering why there was no trigger mechanicism for the SELECT statement? I could find some possible uses for