Search Postgresql Archives

Re: Complex transactions without using plPgSQL Functions. It is possible?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/06/2012 11:30 AM, Andre Lopes wrote:
Hi,

I'm writing a web application that uses PostgreSQL and I need to do
some operations where I read/write to 3 tables in the same
transaction. To do this I need to store the values of variables and
I'm not sure if it is possible to do this without using plPgSQL.

[code]
SELECT count(email) INTO vCONTA_HIST FROM am_newsletter_hist_alter
WHERE email = pEMAIL AND id_website_recolha = pID_WEBSITE_RECOLHA;

IF vCONTA_HIST = 0 THEN
     vNUM_ALTER := 1;
ELSE
     SELECT MAX(num_alter) INTO vNUM_ALTER_ACT FROM am_newsletter_hist_alter
     WHERE email = pEMAIL AND id_website_recolha = pID_WEBSITE_RECOLHA LIMIT 1;
     vNUM_ALTER := vNUM_ALTER_ACT + 1;
END IF;
[/code]

This is the plPgSQL code that I need to write in Python. It is
possible to do this without using PlPgSQL?

Sure:

http://www.postgresql.org/docs/9.0/interactive/plpython-database.html


Best Regards,



--
Adrian Klaver
adrian.klaver@xxxxxxxxx

--
Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux