dbTalk Databases Forums  

PL/Perl and transactions

comp.databases.postgresql comp.databases.postgresql


Discuss PL/Perl and transactions in the comp.databases.postgresql forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Vesa-Matti Kari
 
Posts: n/a

Default PL/Perl and transactions - 03-13-2008 , 03:24 PM






Hello!

I need to do SELECT and DELETE as a single atomic operation. Is it
possible to use transactions in Postgresql PL/Perl functions?
If yes, how? Any pointers would be appreciated. Thanks!

Regards,
vmk
--
************************************************** **************************
"Hacks are stupid things" - someone
************************************************** **************************

Reply With Quote
  #2  
Old   
Andreas Kretschmer
 
Posts: n/a

Default Re: PL/Perl and transactions - 03-14-2008 , 01:50 AM






begin Vesa-Matti Kari schrieb:
Quote:
Hello!

I need to do SELECT and DELETE as a single atomic operation. Is it
possible to use transactions in Postgresql PL/Perl functions?
If yes, how? Any pointers would be appreciated. Thanks!
Sure. A function, also a pl/perl - function, runs within a transaction.
But you can't do a 'begin' ... 'commit;' within the function. Simply
write your function and call it, it's an atomic transaction.


end
Andreas
--
Andreas Kretschmer
Linux - weil ich es mir wert bin!
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net


Reply With Quote
  #3  
Old   
Andreas Kretschmer
 
Posts: n/a

Default Re: PL/Perl and transactions - 03-14-2008 , 01:50 AM



begin Vesa-Matti Kari schrieb:
Quote:
Hello!

I need to do SELECT and DELETE as a single atomic operation. Is it
possible to use transactions in Postgresql PL/Perl functions?
If yes, how? Any pointers would be appreciated. Thanks!
Sure. A function, also a pl/perl - function, runs within a transaction.
But you can't do a 'begin' ... 'commit;' within the function. Simply
write your function and call it, it's an atomic transaction.


end
Andreas
--
Andreas Kretschmer
Linux - weil ich es mir wert bin!
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net


Reply With Quote
  #4  
Old   
Andreas Kretschmer
 
Posts: n/a

Default Re: PL/Perl and transactions - 03-14-2008 , 01:50 AM



begin Vesa-Matti Kari schrieb:
Quote:
Hello!

I need to do SELECT and DELETE as a single atomic operation. Is it
possible to use transactions in Postgresql PL/Perl functions?
If yes, how? Any pointers would be appreciated. Thanks!
Sure. A function, also a pl/perl - function, runs within a transaction.
But you can't do a 'begin' ... 'commit;' within the function. Simply
write your function and call it, it's an atomic transaction.


end
Andreas
--
Andreas Kretschmer
Linux - weil ich es mir wert bin!
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net


Reply With Quote
  #5  
Old   
Andreas Kretschmer
 
Posts: n/a

Default Re: PL/Perl and transactions - 03-14-2008 , 01:50 AM



begin Vesa-Matti Kari schrieb:
Quote:
Hello!

I need to do SELECT and DELETE as a single atomic operation. Is it
possible to use transactions in Postgresql PL/Perl functions?
If yes, how? Any pointers would be appreciated. Thanks!
Sure. A function, also a pl/perl - function, runs within a transaction.
But you can't do a 'begin' ... 'commit;' within the function. Simply
write your function and call it, it's an atomic transaction.


end
Andreas
--
Andreas Kretschmer
Linux - weil ich es mir wert bin!
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net


Reply With Quote
  #6  
Old   
Andreas Kretschmer
 
Posts: n/a

Default Re: PL/Perl and transactions - 03-14-2008 , 01:50 AM



begin Vesa-Matti Kari schrieb:
Quote:
Hello!

I need to do SELECT and DELETE as a single atomic operation. Is it
possible to use transactions in Postgresql PL/Perl functions?
If yes, how? Any pointers would be appreciated. Thanks!
Sure. A function, also a pl/perl - function, runs within a transaction.
But you can't do a 'begin' ... 'commit;' within the function. Simply
write your function and call it, it's an atomic transaction.


end
Andreas
--
Andreas Kretschmer
Linux - weil ich es mir wert bin!
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net


Reply With Quote
  #7  
Old   
Andreas Kretschmer
 
Posts: n/a

Default Re: PL/Perl and transactions - 03-14-2008 , 01:50 AM



begin Vesa-Matti Kari schrieb:
Quote:
Hello!

I need to do SELECT and DELETE as a single atomic operation. Is it
possible to use transactions in Postgresql PL/Perl functions?
If yes, how? Any pointers would be appreciated. Thanks!
Sure. A function, also a pl/perl - function, runs within a transaction.
But you can't do a 'begin' ... 'commit;' within the function. Simply
write your function and call it, it's an atomic transaction.


end
Andreas
--
Andreas Kretschmer
Linux - weil ich es mir wert bin!
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net


Reply With Quote
  #8  
Old   
Andreas Kretschmer
 
Posts: n/a

Default Re: PL/Perl and transactions - 03-14-2008 , 01:50 AM



begin Vesa-Matti Kari schrieb:
Quote:
Hello!

I need to do SELECT and DELETE as a single atomic operation. Is it
possible to use transactions in Postgresql PL/Perl functions?
If yes, how? Any pointers would be appreciated. Thanks!
Sure. A function, also a pl/perl - function, runs within a transaction.
But you can't do a 'begin' ... 'commit;' within the function. Simply
write your function and call it, it's an atomic transaction.


end
Andreas
--
Andreas Kretschmer
Linux - weil ich es mir wert bin!
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net


Reply With Quote
  #9  
Old   
Andreas Kretschmer
 
Posts: n/a

Default Re: PL/Perl and transactions - 03-14-2008 , 01:50 AM



begin Vesa-Matti Kari schrieb:
Quote:
Hello!

I need to do SELECT and DELETE as a single atomic operation. Is it
possible to use transactions in Postgresql PL/Perl functions?
If yes, how? Any pointers would be appreciated. Thanks!
Sure. A function, also a pl/perl - function, runs within a transaction.
But you can't do a 'begin' ... 'commit;' within the function. Simply
write your function and call it, it's an atomic transaction.


end
Andreas
--
Andreas Kretschmer
Linux - weil ich es mir wert bin!
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net


Reply With Quote
  #10  
Old   
Vesa-Matti Kari
 
Posts: n/a

Default Re: PL/Perl and transactions - 03-14-2008 , 03:09 AM



Andreas Kretschmer <akretschmer (AT) spamfence (DOT) net> wrote:
Quote:
begin Vesa-Matti Kari schrieb:
Hello!

I need to do SELECT and DELETE as a single atomic operation. Is it
possible to use transactions in Postgresql PL/Perl functions?
If yes, how? Any pointers would be appreciated. Thanks!

Sure. A function, also a pl/perl - function, runs within a transaction.
But you can't do a 'begin' ... 'commit;' within the function. Simply
write your function and call it, it's an atomic transaction.
That's great news. Thanks for the info!

Regards,
vmk
--
************************************************** **************************
"Hacks are stupid things" - someone
************************************************** **************************


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



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.