Re: Undoing a typo?

Поиск
Список
Период
Сортировка
От Garrett Bladow
Тема Re: Undoing a typo?
Дата
Msg-id Pine.LNX.4.21.0212101055350.8878-100000@imap2.sendit.nodak.edu
обсуждение исходный текст
Ответ на Undoing a typo?  ("Steven Ames" <steve@virtual-voodoo.com>)
Список pgsql-novice
The clever way is called a transaction.
Before doing any data manipulation, start a transaction.
Like this:
BEGIN;    http://developer.postgresql.org/docs/postgres/sql-begin.html

Then do your update statements;

Then if there was an error type:
ROLLBACK; http://developer.postgresql.org/docs/postgres/sql-rollback.html
This will revert you data back to the state it was in before the transaction.

If there wasn't an error and the data looks sound type:
COMMIT; http://developer.postgresql.org/docs/postgres/sql-commit.html
and the updates will be saved.

-- Garrett Bladow

---- This is what you wrote me ----

:This is a truly novice question but here goes:
:
:Yesterday I was on the command line and issued an UPDATE command. Right after I hit the ENTER key I realized that I
forgotto put the WHERE clause in... so... every entry in the table got the update. Ooops. Since I hadn't updated this
particulartable in a while I just dropped it and put it back in from a backup. 
:
:My question is... is there a clever way to undo or rollback a mistake you make at the 'psql' prompt?
:
:-Steve
:


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

Предыдущее
От: "Steven Ames"
Дата:
Сообщение: Undoing a typo?
Следующее
От: Ludwig Lim
Дата:
Сообщение: Re: How many connections can a Postgress database support...