Re: [SQL] Triggers on system tables

2010-03-03 Thread Andreas Kretschmer
Gianvito Pio 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. (Linus Torvalds) "If

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 > tabl

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: Heynit

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

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 appropriat

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 de

Re: [SQL] Triggers using PL/pgSQL

2006-07-31 Thread George Weaver
- Original Message - From: Aaron Bono To: John DeSoi 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 d

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 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 (ma

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 va

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 kno

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 operation

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 a

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]> wrot

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 separat

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 BEFOR

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 broadcast)

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 O

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 understa

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 έγραψε στις N

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 ab

Re: [SQL] Triggers

2005-11-22 Thread Leif B. Kristensen
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 >> subject, but I don't see how to implement a tr

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 'p

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 se

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 'start_date','end_da

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 subscribe-nomai

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: ex

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

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

2004-07-08 Thread SZUCS Gábor
I'd like to add that a NULL value might mess things up. If CreateTime may be null, try this: if (OLD.CreateTime <> NEW.CreateTime) OR (OLD.CreateTime ISNULL <> NEW.CreateTime ISNULL) THEN ... or this: if COALESCE(OLD.CreateTime, '3001-01-01') <> COALESCE(NEW.CreateTime, '3001-01-01

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

2004-07-07 Thread Richard Huxton
Pradeepkumar, Pyatalo (IE10) wrote: Thanks a lot for ur help. In the trigger, I am checking if a field is updated or not. The syntax I use is IF UPDATE(CreateTime) THEN END IF; Is this syntax correct. No, and I don't recall seeing anything like it in the manuals. IF OLD

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

2004-07-07 Thread Pradeepkumar, Pyatalo (IE10)
, 2004 12:50 PM To: Pradeepkumar, Pyatalo (IE10) Cc: [EMAIL PROTECTED] Subject: Re: [SQL] Triggers - need help !!! On 2004-07-07 08:45, UÅytkownik Pradeepkumar, Pyatalo (IE10) napisaÅ: > Hi, > > I am writing some triggers for my project. > I am writing a trigger on a table after delete.

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

2004-07-07 Thread Tomasz Myrta
On 2004-07-07 08:45, UÅytkownik Pradeepkumar, Pyatalo (IE10) napisaÅ: 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 r

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 Functio

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 > >

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

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

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 which

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 cr

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

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 broadcast)

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 us

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 in

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 t

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. > > - Rich

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

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

Re: [SQL] triggers and plpgsql question

2002-08-27 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

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 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 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 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 s

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

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 Tom Lane
Reiner Dassing <[EMAIL PROTECTED]> writes: > I have a table which has a lot of entries (some x millions) of the kind > (id, timestamp, value) > The access (selects) is concentrated to the timely last some thousands > entries. > To adapt this fact I want to setup a "virtual" table - test in my > e

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 fi

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 V

Re: [SQL] Triggers do not fire

2001-10-16 Thread Stephan Szabo
> The result is as follows: > INSERT INTO test VALUES(1,'2000-10-11 12:00:00',-20.2); > NOTICE: Fired INSERT > INSERT 0 0 > UPDATE test SET value = 1000.0 WHERE epoch = '2000-10-11 12:10:00' AND > sensor_id = 1; > UPDATE 0 > > The insert notice can be shown! > The update notice is not there! >