Re: InitPostgres and flatfiles question

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Markus Schiltknecht <markus(at)bluegap(dot)ch>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: InitPostgres and flatfiles question
Date: 2007-01-06 22:01:57
Message-ID: 200701062201.l06M1vJ03895@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


Do we need a TODO for this?

---------------------------------------------------------------------------

Tom Lane wrote:
> Markus Schiltknecht <markus(at)bluegap(dot)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.
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2007-01-06 22:06:36 Re: Mark/Restore and avoiding RandomAccess sorts
Previous Message Bruce Momjian 2007-01-06 21:58:11 Re: InitPostgres and flatfiles question