473,324 Members | 2,254 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

After update complete set

Hello list,

Is there a way in pg to fire a function when a complete (not row by row)
set is updated/inserted/deleted, for instance.

update order_detail set confirmed='S' where modifieddate=current_date;

Then after all the affected rows are updated, I need some code to
uptaded other tables from the information of the updated rows in the
details table.

Thanks in advance.

--
Sinceramente,
Josué Maldonado.

"Cuando los ricos se hacen la guerra, son los pobres los que mueren."
Jean Paul Sartre. Filósofo y escritor francés.

---------------------------(end of broadcast)---------------------------
TIP 5: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faqs/FAQ.html

Nov 23 '05 #1
2 1276
Josué Maldonado wrote:
Hello list,

Is there a way in pg to fire a function when a complete (not row by
row) set is updated/inserted/deleted, for instance.

update order_detail set confirmed='S' where modifieddate=current_date;

Then after all the affected rows are updated, I need some code to
uptaded other tables from the information of the updated rows in the
details table.

Thanks in advance.

I'm interested in other's responce to this question as well.
I recently had to implement an equivelent trigger mechanism.
My solution consist of the following steps:
create an intermediate table to hold the minimum data needed for
single action trigger.
create a before trigger on insert, update, and delete which inserts
the needed data from the NEW construct if in insert or update and
inserts the needed data from OLD if in update or delete with a check for
prior existance (by the end of transaction this table is emptied).
create an after insert trigger on the intermediate table to perform
withever action is needed on the data, then delete the specific row in
the intermediate table.

The intermediate table would have a primary key which could be imposed
by a sequence (which I would set to cycle, so as long as you don't have
2^32, simultaneous transactions updating the base table you should be fine).

Hope this helps.
---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #2
=?ISO-8859-1?Q?Josu=E9_Maldonado?= <jo***@lamundial.hn> writes:
Is there a way in pg to fire a function when a complete (not row by row)
set is updated/inserted/deleted,


Perhaps you want an AFTER STATEMENT trigger? Those are supported as of
7.4.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
joining column's datatypes do not match

Nov 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: laurie | last post by:
Hi all, I'm trying to help out a friend who has inherited a client with a PHP shopping cart application. Neither of us know PHP, but I've been muddling my way through, trying to get these old...
2
by: William Wisnieski | last post by:
Hi Everyone, Access 2000 I have some code behind a button that performs a word merge with a query data source. The merge works fine. But what I'd like to do somehow is after the merge is...
4
by: deko | last post by:
I'm a little nervous about slamming my database with a dozen Update queries in a loop that all modify RecordSources of open forms. Will the use of DoEvents and/or a Sleep function ameliorate any...
3
by: Glen | last post by:
This is my first attempt as asynchronous processing. I have created a small test app as proof of concept, but I am having one proglem. In the example (code listed below), my callback routine has...
7
by: gthompson | last post by:
Is this possible: Read fields(rows/columns) from one sql database table (TableA). Then edit/update the same 'field' in TableA; and in TableB edit/update a different field - all at the same time?...
2
by: P K | last post by:
I am using server.transfer for a website being developed in vs.net 2005 And I need to get the posted values after server.transfer. For this I set the second parameter "true" in the transfer...
15
by: graham | last post by:
Hi all, <bitching and moaning section> I am asking for any help I can get here... I am at the end of my tether... I don;t consider myself a genius in any way whatsoever, but I do believe I have...
5
by: parwal.sandeep | last post by:
Hello grp! i'm using INNODB tables which are using frequently . if i fire a SELECT query which fetch major part of table it usually take 10-20 seconds to complete. in mean time if any UPDATE...
1
by: James Hallam | last post by:
I have a parent record with a child record. The parent record contains structures and the child records contains visits to those structures. Each table has a field named "Complete", what I...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.