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
Views: Raw Message | Whole Thread | Download mbox | Resend email
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

Browse pgsql-novice by date

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