Skip site navigation (1) Skip section navigation (2)

Re: TRANSACTION FOR AN UPDATE COMMAND WITH ONE TABLE

From: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
To: JORGE MALDONADO <jorgemal1960(at)gmail(dot)com>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: TRANSACTION FOR AN UPDATE COMMAND WITH ONE TABLE
Date: 2010-04-06 20:31:24
Message-ID: i2k3073cc9b1004061331w8d78da7em35d4d2185781183e@mail.gmail.com (view raw or flat)
Thread:
Lists: pgsql-novice
On Tue, Apr 6, 2010 at 2:23 PM, JORGE MALDONADO <jorgemal1960(at)gmail(dot)com> wrote:
> I have an UPDATE command which modifies several records of one (only one)
> table.
> Is it feasible (or a good idea) to include it in a transaction block to make
> sure the process is performed with integrity?

PostgreSQL runs everything that is not inside a transaction block
inside it's own implicit transaction (one implicit transaction per
statement).
so

begin;
update ....
commit;

it's the same as:

update ....

and

update table1 ...
update table2 ...

it's the same as:

begin;
update table1 ...
commit;

begin;
update table2 ...
commit;

-- 
Atentamente,
Jaime Casanova
Soporte y capacitación de PostgreSQL
Asesoría y desarrollo de sistemas
Guayaquil - Ecuador
Cel. +59387171157

In response to

pgsql-novice by date

Next:From: syan tanDate: 2010-04-07 00:10:42
Subject: Re: slow plan on join when adding where clause
Previous:From: Rob RichardsonDate: 2010-04-06 18:54:28
Subject: Re: TRANSACTION FOR AN UPDATE COMMAND WITH ONE TABLE

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group