Обсуждение: Limit on updates made in a transaction

Поиск
Список
Период
Сортировка

Limit on updates made in a transaction

От
kent@cpttm.org.mo (Kent Tong)
Дата:
Hi,

Is there is any limit on the number of updates made to a
postgreSQL database in a single transaction? If yes, how
can we get around this problem? For example, we need to
update a field of many existing rows in a table triggered
by the addition of a new row. If anything fails in the
update process, we'd like to undone everything (including
the addition of the new row).

Thanks in advance for any info!

Re: Limit on updates made in a transaction

От
Darren Ferguson
Дата:
Use transactions

If you have it stored in a transaction you can rollback the whole
transaction on any error

Begin;

INSERT INTO foo VALUES ('bar');
INSERT INTO foo's VALUES ('bar'); <-- produce error

Rollback;

Now foo will not have the row bar in it

HTH

On 26 Jul 2002, Kent Tong wrote:

> Hi,
>
> Is there is any limit on the number of updates made to a
> postgreSQL database in a single transaction? If yes, how
> can we get around this problem? For example, we need to
> update a field of many existing rows in a table triggered
> by the addition of a new row. If anything fails in the
> update process, we'd like to undone everything (including
> the addition of the new row).
>
> Thanks in advance for any info!
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: you can get off all lists at once with the unregister command
>     (send "unregister YourEmailAddressHere" to majordomo@postgresql.org)
>

--
Darren Ferguson


Re: Limit on updates made in a transaction

От
Richard Huxton
Дата:
On Saturday 27 Jul 2002 4:25 am, Kent Tong wrote:
> Hi,
>
> Is there is any limit on the number of updates made to a
> postgreSQL database in a single transaction?

No - although since the machine needs to be able to rollback the updates you
could run out of resources on the machine.

> If yes, how
> can we get around this problem? For example, we need to
> update a field of many existing rows in a table triggered
> by the addition of a new row. If anything fails in the
> update process, we'd like to undone everything (including
> the addition of the new row).

No problem - that's what the system is designed for.

- Richard Huxton