Unix Technical Forum

executing a dml within a utility

This is a discussion on executing a dml within a utility within the pgsql Hackers forums, part of the PostgreSQL category; --> I created a CMD_UTILITY, which upon being executed by the user should do the following atomically: 1- drops a ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-12-2008, 07:07 AM
Ehab Galal
 
Posts: n/a
Default executing a dml within a utility

I created a CMD_UTILITY, which upon being executed by the user should do the
following atomically:
1- drops a table
2- deletes from another table all rows with a certain criterion: "DELETE
FROM pg_t1 WHERE att = val"
3- deletes from a third table all rows with a certain criterion: "DELETE
FROM pg_t2 WHERE att = val"

I do the first step using ProcessUtility(). How can i do the 2nd/3rd steps?
Any suggestions?

I tried calling exec_simple_query() but this didn't work. I am getting an
error "cannot drop active portal"


Thanks a lot,
ehab

__________________________________________________ _______________
Find sales, coupons, and free shipping, all in one place! *MSN Shopping
Sales & Deals
http://shopping.msn.com/content/shp/...tnrdata=200639


---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-12-2008, 07:07 AM
Alvaro Herrera
 
Posts: n/a
Default Re: executing a dml within a utility

Ehab Galal wrote:
> I created a CMD_UTILITY, which upon being executed by the user should do
> the following atomically:
> 1- drops a table
> 2- deletes from another table all rows with a certain criterion: "DELETE
> FROM pg_t1 WHERE att = val"
> 3- deletes from a third table all rows with a certain criterion: "DELETE
> FROM pg_t2 WHERE att = val"
>
> I do the first step using ProcessUtility(). How can i do the 2nd/3rd steps?
> Any suggestions?


Don't do that. Instead, use performDeletion and register your tuples in
the pg_t1 and pg_t2 catalogs in pg_depend (using recordDependencyOn).

--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo@postgresql.org so that your
message can get through to the mailing list cleanly

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:48 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com