Re: Using transactions with plpythonu

From: Clodoaldo <clodoaldo(dot)pinto(dot)neto(at)gmail(dot)com>
To: imageguy <imageguy1206(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Using transactions with plpythonu
Date: 2007-01-21 15:29:57
Message-ID: a595de7a0701210729t62208a5djaf004ada9bfb5faa@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

21 Jan 2007 06:53:15 -0800, imageguy <imageguy1206(at)gmail(dot)com>:
> > What happens if you do:
> >
> > plpy.execute("BEGIN");
> >
> > before and after
> >
> > plpy.execute("COMMIT");
> >
> > Have a nice day,
> > --
> Thanks for your reply Martin.
> After making my post I decide not to be so lazy and set up a test
> environment.
> After try exactly what you suggested, I got the following error code
> SPI_ERROR_TRANSACTION
>
> A quick search of the documentation and this error code explaination
> is;
> if any command involving transaction manipulation was attempted (BEGIN,
> COMMIT, ROLLBACK, SAVEPOINT, PREPARE TRANSACTION, COMMIT PREPARED,
> ROLLBACK PREPARED, or any variant thereof)
>
> So... unless I am missing something, I would suggest you CANNOT us
> plpython (or perhaps any other pl language ??) to process transactions
> ... of course I am a complete newbie, so I am hoping there is someone
> more senior on this board that could point the way ??

I have been a newbie for a long time. What if you wrap your commands
in a function? A function is a transaction. The function can be
written in plpython if there is the need. I think that would solve
your problem.

Regards,
--
Clodoaldo Pinto Neto

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Joshua D. Drake 2007-01-21 15:39:22 Re: More grist for the PostgreSQL vs MySQL mill
Previous Message brian stone 2007-01-21 14:55:56 postgresql scalability, active-active cluster