Re: InitPostgres and flatfiles question

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: InitPostgres and flatfiles question
Дата
Msg-id 200701110448.l0B4m0m27026@momjian.us
обсуждение исходный текст
Ответ на Re: InitPostgres and flatfiles question  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Tom Lane wrote:
> Markus Schiltknecht <markus@bluegap.ch> writes:
> > I've just found the stumbling block: the -c option of psql wraps all in 
> > a transaction, as man psql says:
> > ...
> > Thank you for clarification, I wouldn't have expected that (especially 
> > because CREATE DATABASE itself says, it cannot be run inside a 
> > transaction block... A transaction block (with BEGIN and COMMIT) seems 
> > to be more than just a transaction, right?)
> 
> Hm, that's an interesting point.  psql's -c just shoves its whole
> argument string at the backend in one PQexec(), instead of dividing
> at semicolons as psql does with normal input.  And so it winds up as
> a single transaction because postgres.c doesn't force a transaction
> commit until the end of the querystring.  But that's not a "transaction
> block" in the normal sense and so it doesn't trigger the
> PreventTransactionChain defense in CREATE DATABASE and elsewhere.
> 
> I wonder whether we ought to change that?  The point of
> PreventTransactionChain is that we don't want the user rolling back
> the statement post-completion, but it seems that
>     psql -c 'CREATE DATABASE foo; ABORT; BEGIN; ...'
> would bypass the check.

Added to TODO:
       o Fix transaction restriction checks for CREATE DATABASE and         other commands
        http://archives.postgresql.org/pgsql-hackers/2007-01/msg00133.php

--  Bruce Momjian   bruce@momjian.us EnterpriseDB    http://www.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: [PATCHES] wal_checksum = on (default) | off
Следующее
От: Bruce Momjian
Дата:
Сообщение: Re: [COMMITTERS] pgsql: Stamp major release 8.3.0,