Обсуждение: TRANSACTION FOR AN UPDATE COMMAND WITH ONE TABLE
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?
Or
Does PostgreSQL has some kind of auto-integrity check with simple DB operations like?
Best regards,
Jorge Maldonado
It seems to me that the correct question would be, "Is there any reason not to use a transaction?"
But please keep in mind that I am not expert in PostgreSQL (or any other database system) by any stretch of the imagination.
RobR
On Tue, Apr 6, 2010 at 2:23 PM, JORGE MALDONADO <jorgemal1960@gmail.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
On 2010-04-06, JORGE MALDONADO <jorgemal1960@gmail.com> wrote: > --001485e609d13a8c510483958cf7 > Content-Type: text/plain; charset=ISO-8859-1 > > 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? > Or > Does PostgreSQL has some kind of auto-integrity check with simple DB > operations like? a single update command either succeeds or fails. if it fails no records will have changed, if it succeds all the matching records will have been updated. wrapping it in a transaction will gain you nothing.