Complex transactions without using plPgSQL Functions. It is possible?

Поиск
Список
Период
Сортировка
От Andre Lopes
Тема Complex transactions without using plPgSQL Functions. It is possible?
Дата
Msg-id CAGFRAbO353vGc9J1MtCii19hAHcmL7aQhHgY0YrCHd2sQENcrw@mail.gmail.com
обсуждение исходный текст
Ответы Re: Complex transactions without using plPgSQL Functions. It is possible?  (Adrian Klaver <adrian.klaver@gmail.com>)
Re: Complex transactions without using plPgSQL Functions. It is possible?  (Chris Angelico <rosuav@gmail.com>)
Re: Complex transactions without using plPgSQL Functions. It is possible?  (Sergey Konoplev <gray.ru@gmail.com>)
Список pgsql-general
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?

Best Regards,

В списке pgsql-general по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Unhelpful initdb error message
Следующее
От: Adrian Klaver
Дата:
Сообщение: Re: Complex transactions without using plPgSQL Functions. It is possible?