pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
When running with autocommit false only the first BEGIN and COMMIT are logged on server
5+ messages / 4 participants
[nested] [flat]

* When running with autocommit false only the first BEGIN and COMMIT are logged on server
@ 2004-11-23 06:12  Barry Lind <blind@xythos.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Barry Lind @ 2004-11-23 06:12 UTC (permalink / raw)
  To: pgsql-jdbc


While debugging my other server problem, I noticed that that only the
first BEGIN and COMMIT are logged on the server with sql statement
logging enabled.  It seems that the subsequent transaction control
statements are being executed correctly, it is just that they are not
being logged by the server.  Is this to be expected?  If so, it makes
debugging a bit difficult as you can't see what commits are really being
executed when you have sql statement logging enabled.

Thanks,
--Barry 



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

* Re: When running with autocommit false only the first BEGIN
@ 2004-11-23 10:21  Oliver Jowett <oliver@opencloud.com>
  parent: Barry Lind <blind@xythos.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Oliver Jowett @ 2004-11-23 10:21 UTC (permalink / raw)
  To: Barry Lind <blind@xythos.com>; +Cc: pgsql-jdbc

Barry Lind wrote:
> While debugging my other server problem, I noticed that that only the
> first BEGIN and COMMIT are logged on the server with sql statement
> logging enabled.  It seems that the subsequent transaction control
> statements are being executed correctly, it is just that they are not
> being logged by the server.  Is this to be expected?  If so, it makes
> debugging a bit difficult as you can't see what commits are really being
> executed when you have sql statement logging enabled.

Yeah, it's a limitation of statement logging. Statements are logged only 
on Parse, not on Bind/Execute. The driver reuses the internal 
BEGIN/COMMIT statements, so only one Parse is done for each. You will 
see the same thing for user queries if they end up using server-side 
prepare.

There should be some past discussion about this in the -hackers archives.

-O



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

* Re: When running with autocommit false only the first BEGIN
@ 2004-11-23 12:04  Dave Cramer <pg@fastcrypt.com>
  parent: Oliver Jowett <oliver@opencloud.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Dave Cramer @ 2004-11-23 12:04 UTC (permalink / raw)
  To: Oliver Jowett <oliver@opencloud.com>; +Cc: Barry Lind <blind@xythos.com>; pgsql-jdbc

That certainly doesn't seem acceptable. As Barry points out people will 
really be in the dark when their code doesn't work.

--dc--

Oliver Jowett wrote:

> Barry Lind wrote:
>
>> While debugging my other server problem, I noticed that that only the
>> first BEGIN and COMMIT are logged on the server with sql statement
>> logging enabled.  It seems that the subsequent transaction control
>> statements are being executed correctly, it is just that they are not
>> being logged by the server.  Is this to be expected?  If so, it makes
>> debugging a bit difficult as you can't see what commits are really being
>> executed when you have sql statement logging enabled.
>
>
> Yeah, it's a limitation of statement logging. Statements are logged 
> only on Parse, not on Bind/Execute. The driver reuses the internal 
> BEGIN/COMMIT statements, so only one Parse is done for each. You will 
> see the same thing for user queries if they end up using server-side 
> prepare.
>
> There should be some past discussion about this in the -hackers archives.
>
> -O
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
>
>

-- 
Dave Cramer
http://www.postgresintl.com
519 939 0336
ICQ#14675561




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

* Re: When running with autocommit false only the first BEGIN
@ 2004-11-23 12:18  Oliver Jowett <oliver@opencloud.com>
  parent: Dave Cramer <pg@fastcrypt.com>
  0 siblings, 1 reply; 5+ messages in thread

From: Oliver Jowett @ 2004-11-23 12:18 UTC (permalink / raw)
  To: pg@fastcrypt.com; +Cc: Barry Lind <blind@xythos.com>; pgsql-jdbc

Dave Cramer wrote:
> That certainly doesn't seem acceptable. As Barry points out people will 
> really be in the dark when their code doesn't work.

There's nothing much the driver can do about it other than not using the 
new features of V3. This needs a server-side fix.

We could make BEGIN/COMMIT/ROLLBACK more visible at the (small) cost of 
an extra Parse on each execution. But you're still going to have the 
same problem with user queries once statements start using server-side 
prepare.

See http://archives.postgresql.org/pgsql-hackers/2004-05/msg01173.php 
for past discussion. I looked at fixing it briefly but didn't have time 
to put together a patch.

-O



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

* Re: When running with autocommit false only the first BEGIN
@ 2004-11-23 15:48  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Oliver Jowett <oliver@opencloud.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2004-11-23 15:48 UTC (permalink / raw)
  To: Oliver Jowett <oliver@opencloud.com>; +Cc: pg@fastcrypt.com; Barry Lind <blind@xythos.com>; pgsql-jdbc

Oliver Jowett <oliver@opencloud.com> writes:
> Dave Cramer wrote:
>> That certainly doesn't seem acceptable. As Barry points out people will 
>> really be in the dark when their code doesn't work.

> There's nothing much the driver can do about it other than not using the 
> new features of V3. This needs a server-side fix.

Step right up ;-)

> See http://archives.postgresql.org/pgsql-hackers/2004-05/msg01173.php 
> for past discussion. I looked at fixing it briefly but didn't have time 
> to put together a patch.

I think the code changes would be minimal, the hard part is agreeing on
desirable behavior.  From the point of view of "logging what actually
happened", logging at Execute would make sense; but as Oliver noted in
the above thread, that would lose the ability to log statements with
parse errors, which is not good either.  And what about being able to
see the actual parameters sent in Bind?

Also it would be good to think about a saner behavior for logging
statements executed via SPI (ie plpgsql functions) --- we've been living
with essentially these same problems for years there, and no one's very
happy about it.

			regards, tom lane



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


end of thread, other threads:[~2004-11-23 15:48 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-11-23 06:12 When running with autocommit false only the first BEGIN and COMMIT are logged on server Barry Lind <blind@xythos.com>
2004-11-23 10:21 ` Re: When running with autocommit false only the first BEGIN Oliver Jowett <oliver@opencloud.com>
2004-11-23 12:04   ` Re: When running with autocommit false only the first BEGIN Dave Cramer <pg@fastcrypt.com>
2004-11-23 12:18     ` Re: When running with autocommit false only the first BEGIN Oliver Jowett <oliver@opencloud.com>
2004-11-23 15:48       ` Re: When running with autocommit false only the first BEGIN Tom Lane <tgl@sss.pgh.pa.us>

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