Thread: sql transaction

sql transaction

From
Jasid ZA
Date:
Hi,

Can we use sql transactions(BEGIN, ROllBACK, COMMIT etc) in a postgresql function(user defined) which is written in PL/Perl?

Thanks in advance
 --
With warm regards

Jasid Z. A
+91 9946109809

Re: sql transaction

From
Andreas Kretschmer
Date:
Jasid ZA <za.jasid@gmail.com> wrote:

> Hi,
>
> Can we use sql transactions(BEGIN, ROllBACK, COMMIT etc) in a postgresql
> function(user defined) which is written in PL/Perl?

No. A function is an autonomous transaction. You can use savepoints.


Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

Re: sql transaction

From
Alvaro Herrera
Date:
Andreas Kretschmer wrote:
> Jasid ZA <za.jasid@gmail.com> wrote:
>
> > Hi,
> >
> > Can we use sql transactions(BEGIN, ROllBACK, COMMIT etc) in a postgresql
> > function(user defined) which is written in PL/Perl?
>
> No. A function is an autonomous transaction. You can use savepoints.

This question comes up very often.  Would somebody please write it and a
detailed answer to add to the FAQ in the Wiki?

http://wiki.postgresql.org/wiki/FAQ

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Re: sql transaction

From
Andreas Kretschmer
Date:
Alvaro Herrera <alvherre@commandprompt.com> wrote:

> Andreas Kretschmer wrote:
> > Jasid ZA <za.jasid@gmail.com> wrote:
> >
> > > Hi,
> > >
> > > Can we use sql transactions(BEGIN, ROllBACK, COMMIT etc) in a postgresql
> > > function(user defined) which is written in PL/Perl?
> >
> > No. A function is an autonomous transaction. You can use savepoints.
>
> This question comes up very often.  Would somebody please write it and a
> detailed answer to add to the FAQ in the Wiki?

I would do it, but unfortunately my english is too bad...


Andreas
--
Really, I'm not out to destroy Microsoft. That will just be a completely
unintentional side effect.                              (Linus Torvalds)
"If I was god, I would recompile penguin with --enable-fly."   (unknown)
Kaufbach, Saxony, Germany, Europe.              N 51.05082°, E 13.56889°

Re: sql transaction

From
Alvaro Herrera
Date:
Andreas Kretschmer wrote:
> Alvaro Herrera <alvherre@commandprompt.com> wrote:
>
> > Andreas Kretschmer wrote:
> > > Jasid ZA <za.jasid@gmail.com> wrote:
> > >
> > > > Hi,
> > > >
> > > > Can we use sql transactions(BEGIN, ROllBACK, COMMIT etc) in a postgresql
> > > > function(user defined) which is written in PL/Perl?
> > >
> > > No. A function is an autonomous transaction. You can use savepoints.
> >
> > This question comes up very often.  Would somebody please write it and a
> > detailed answer to add to the FAQ in the Wiki?
>
> I would do it, but unfortunately my english is too bad...

So add it to the German FAQ, and ask someone to translate it to english?

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Re: sql transaction

From
Tino Wildenhain
Date:
Alvaro Herrera wrote:
> Andreas Kretschmer wrote:
>> Alvaro Herrera <alvherre@commandprompt.com> wrote:
>>
>>> Andreas Kretschmer wrote:
>>>> Jasid ZA <za.jasid@gmail.com> wrote:
>>>>
>>>>> Hi,
>>>>>
>>>>> Can we use sql transactions(BEGIN, ROllBACK, COMMIT etc) in a postgresql
>>>>> function(user defined) which is written in PL/Perl?
>>>> No. A function is an autonomous transaction. You can use savepoints.
>>> This question comes up very often.  Would somebody please write it and a
>>> detailed answer to add to the FAQ in the Wiki?
>> I would do it, but unfortunately my english is too bad...
>
> So add it to the German FAQ, and ask someone to translate it to english?
>
Of course its already in the documentation - not sure if the posters
of this question in the mail already read the documentation, the faq
or much less checked the mail archive ;-)

But this sounds like fun, I'll check how to add something to the
documentation :-)

Regards
Tino

Attachment

Re: sql transaction

From
Alvaro Herrera
Date:
Tino Wildenhain wrote:

> But this sounds like fun, I'll check how to add something to the
> documentation :-)

Of course it is fun.  Why else do you think I spend time on it?

--
Alvaro Herrera                                http://www.CommandPrompt.com/
PostgreSQL Replication, Consulting, Custom Development, 24x7 support

Re: sql transaction

From
Gurjeet Singh
Date:
On Wed, Mar 18, 2009 at 7:11 PM, Andreas Kretschmer <akretschmer@spamfence.net> wrote:
Jasid ZA <za.jasid@gmail.com> wrote:

> Hi,
>
> Can we use sql transactions(BEGIN, ROllBACK, COMMIT etc) in a postgresql
> function(user defined) which is written in PL/Perl?

No. A function is an autonomous transaction. You can use savepoints.

No, a function is not an autonomous transaction (at least not what that term stands for in Oracle).

Best regards,
--
gurjeet[.singh]@EnterpriseDB.com
singh.gurjeet@{ gmail | hotmail | indiatimes | yahoo }.com

EnterpriseDB      http://www.enterprisedb.com

Mail sent from my BlackLaptop device