pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Always get TranBlock notice using 'c'
2+ messages / 2 participants
[nested] [flat]

* Always get TranBlock notice using 'c'
@ 1999-12-23 20:51  Robert Rothe <rrothe@mindspring.com>
  0 siblings, 1 reply; 2+ messages in thread

From: Robert Rothe @ 1999-12-23 20:51 UTC (permalink / raw)
  To: pgsql-interfaces

All,

When writing apps using 'c' and the preprocessor, I always get a
"NOTICE: BeginTransactionBlock not in default state" with my first BEGIN
statement.  I've tried placing a COMMIT and END at the beginning of the
app, but then I just get a NOTICE on the commit and another one on the
BEGIN.

This does not happen when using interactive pgsql.

Is this addressed in an FAQ or can someone point me to the right place? 
Seems the app does not start in the default state.

Thanks in advance,
Rob



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

* Re: [INTERFACES] Always get TranBlock notice using 'c'
@ 1999-12-24 09:56  Michael Meskes <meskes@postgresql.org>
  parent: Robert Rothe <rrothe@mindspring.com>
  0 siblings, 0 replies; 2+ messages in thread

From: Michael Meskes @ 1999-12-24 09:56 UTC (permalink / raw)
  To: Robert Rothe <rrothe@mindspring.com>; +Cc: pgsql-interfaces

On Thu, Dec 23, 1999 at 03:51:28PM -0500, Robert Rothe wrote:
> When writing apps using 'c' and the preprocessor, I always get a
> "NOTICE: BeginTransactionBlock not in default state" with my first BEGIN

If you want to expclicitely call BEGIN you either have to call ecpg with
option '-t' to change the default value or issue a EXEC SQL SET AUTOCOMMIT ON
in your program.

> statement.  I've tried placing a COMMIT and END at the beginning of the
> app, but then I just get a NOTICE on the commit and another one on the
> BEGIN.

The default of ecpg is that it creates a transaction for all your action
automatically and you just issue COMMITs. After a COMMIT ecpg issues a BEGIN
all by himself. With SUTOCOMMIT set to ON ecpg uses the same logic as psql
for instance, namely that each statement is a transaction of its own unless
you issue a BEGIN.

Michael
-- 
Michael Meskes                         | Go SF 49ers!
Th.-Heuss-Str. 61, D-41812 Erkelenz    | Go Rhein Fire!
Tel.: (+49) 2431/72651                 | Use Debian GNU/Linux!
Email: Michael@Fam-Meskes.De           | Use PostgreSQL!



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


end of thread, other threads:[~1999-12-24 09:56 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
1999-12-23 20:51 Always get TranBlock notice using 'c' Robert Rothe <rrothe@mindspring.com>
1999-12-24 09:56 ` 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