Always get TranBlock notice using 'c'
Always get TranBlock notice using 'c'
От:
Robert Rothe <rrothe@mindspring.com>
Дата:
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
Re: [INTERFACES] Always get TranBlock notice using 'c'
От:
Michael Meskes <meskes@postgresql.org>
Дата:
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!