Re: pg_query transaction: auto rollback? begin or start?? commit or end???

Поиск
Список
Период
Сортировка
От Chris
Тема Re: pg_query transaction: auto rollback? begin or start?? commit or end???
Дата
Msg-id 4887F43E.7010104@gmail.com
обсуждение исходный текст
Ответ на Re: pg_query transaction: auto rollback? begin or start?? commit or end???  ("Bill Wordsworth" <bill.wordsworth@gmail.com>)
Ответы Re: pg_query transaction: auto rollback? begin or start?? commit or end???  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
Список pgsql-general
Bill Wordsworth wrote:
> Thanks Chris and Karsten. I still don't quite understand why invalid
> state/record-mismatch would also not trigger auto rollback.

If you should have put id 5 instead of id 2 as a foreign key, how is the
database going to know the difference? Both are valid id's and valid
data for an "int" type field.

 How can I
> even include something *outside* a transaction *inside* it- shouldn't
> everything between "begin" and "end" be subject to auto rollback no
> matter what?

Most things in postgres are transaction safe, some aren't like "cluster"
or "vacuum full". I couldn't find a list of things that won't work in a
transaction but it's a pretty short list. Even table changes (alter
table, create index etc) are transaction safe.

Maybe I misunderstand the question.

> Also what is the best way to check if transaction is 'read write'
> after doing 'pg_query("begin transaction read write;", $connection);'.
> pg_transaction_status() doesn't quite do it (read write=?=2).

That's going to report if you're inside a transaction or not, it's not
going to report what transaction level you are in. I don't think there's
a way to show that.

--
Postgresql & php tutorials
http://www.designmagick.com/

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

Предыдущее
От: Craig Ringer
Дата:
Сообщение: Re: mac install question
Следующее
От: Shane Ambler
Дата:
Сообщение: Re: mac install question