pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
ECPG - Clarfication of '-t', 'autocommit', BEGIN?
2+ messages / 2 participants
[nested] [flat]

* ECPG - Clarfication of '-t', 'autocommit', BEGIN?
@ 2002-09-26 17:57  William West <wwest@csc.com>
  0 siblings, 1 reply; 2+ messages in thread

From: William West @ 2002-09-26 17:57 UTC (permalink / raw)
  To: pgsql-interfaces

The ecpg man page says that '-t' will turn autocommit 'on', that
the default is that otherwise a 'commit' statement is needed to
cause a 'commit'.

In a posting from December of 2001, there was a complaint
that issuing EXEC SQL BEGIN; immediately following
CONNECT returned "BEGIN: already a transaction in progress",
to which Michael Meskes replied that it is necessary to run ecpg
*with* the '-t' switch (or, as someone else said, issue 'exec sql set
autocommit to on') if you want to BEGIN your own transactions.

Am I wrong in thinking that BEGIN-(set of commands)
-COMMIT should be equivalent to 'start transaction
-perform sequence of commands-commit result of
sequence of commands'? Or does BEGIN become
superfluous when running *without* -t? Could someone
please clarify?

Thanks.





^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: ECPG - Clarfication of '-t', 'autocommit', BEGIN?
@ 2002-09-27 11:26  Michael Meskes <meskes@postgresql.org>
  parent: William West <wwest@csc.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Meskes @ 2002-09-27 11:26 UTC (permalink / raw)
  To: William West <wwest@csc.com>; +Cc: pgsql-interfaces

On Thu, Sep 26, 2002 at 01:57:40PM -0400, William West wrote:
> The ecpg man page says that '-t' will turn autocommit 'on', that
> the default is that otherwise a 'commit' statement is needed to
> cause a 'commit'.
> ...

Which indeed is correct. "Autocommit" means that the mode is the same as
with for instance psql. Each statement is run inside its own transaction
and thus you do only need a "commit" if you specified a "begin" before.

Without "autocommit" the mode is equivalent to Oracle in that an
explicit transaction is started automatically and all you need to do is
issue a "commit" or "rollback" to end. After that a new transaction is
started immediately.

> Am I wrong in thinking that BEGIN-(set of commands)
> -COMMIT should be equivalent to 'start transaction
> -perform sequence of commands-commit result of
> sequence of commands'? Or does BEGIN become
> superfluous when running *without* -t? Could someone
> please clarify?

Yes, that's it. No need to say "begin" when not using "-t".

Michael
-- 
Michael Meskes
Michael@Fam-Meskes.De
Go SF 49ers! Go Rhein Fire!
Use Debian GNU/Linux! Use PostgreSQL!



^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2002-09-27 11:26 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-09-26 17:57 ECPG - Clarfication of '-t', 'autocommit', BEGIN? William West <wwest@csc.com>
2002-09-27 11:26 ` Michael Meskes <meskes@postgresql.org>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox