pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Driver confused by explicit transactions
5+ messages / 2 participants
[nested] [flat]

* Driver confused by explicit transactions
@ 2002-12-06 23:47  Glen Parker <glenebob@nwlink.com>
  0 siblings, 2 replies; 5+ messages in thread

From: Glen Parker @ 2002-12-06 23:47 UTC (permalink / raw)
  To: pgsql-odbc

It appears there is a somewhat on-going bug in the ODBC driver
(07.02.0005 in this case) concerning explicit transactions.  The
following sequence demonstrates it.

Begin transaction   (OK)
Execute update statement(s)   (OK, records hidden from other
transactions)
Commit transaction    (OK, records appear to other transactions)
Execute update statement(s)    (OK, but records hidden from other
transactions, should be visible)
Commit transaction    (OK, records appear to other transactions)

I'm going to dive into the code and see what I see, but wanted to report
the symptoms so others can look too.  I suspect the driver is failing to
turn auto-commit mode back on after the explicit commit, and is starting
a new transaction for statements following the commit when it should not
be, which do not get committed automatically.

Glen Parker
glenebob@nwlink.com




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

* Re: Driver confused by explicit transactions
@ 2002-12-07 00:28  Glen Parker <glenebob@nwlink.com>
  parent: Glen Parker <glenebob@nwlink.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Glen Parker @ 2002-12-07 00:28 UTC (permalink / raw)
  To: pgsql-odbc

It appears that this is fixed simply by having PGAPI_Transact() call
CC_set_autocommit_on(conn) after sending and verifying success of a
commit/abort statement to the server.  That makes the end of
PGAPI_Transact() look like this in my copy:


		if (!ok)
		{
			CC_on_abort(conn, NO_TRANS);
			CC_log_error(func, "", conn);
			return SQL_ERROR;
		}

		/* get (back) into auto-commit mode */
		CC_set_autocommit_on(conn);
	}
	return SQL_SUCCESS;
}


Glen Parker
glenebob@nwlink.com




> It appears there is a somewhat on-going bug in the ODBC driver
> (07.02.0005 in this case) concerning explicit transactions.  The
> following sequence demonstrates it.
> 
> Begin transaction   (OK)
> Execute update statement(s)   (OK, records hidden from other
> transactions)
> Commit transaction    (OK, records appear to other transactions)
> Execute update statement(s)    (OK, but records hidden from other
> transactions, should be visible)
> Commit transaction    (OK, records appear to other transactions)
> 
> I'm going to dive into the code and see what I see, but 
> wanted to report
> the symptoms so others can look too.  I suspect the driver is 
> failing to
> turn auto-commit mode back on after the explicit commit, and 
> is starting
> a new transaction for statements following the commit when it 
> should not
> be, which do not get committed automatically.
> 
> Glen Parker
> glenebob@nwlink.com
> 
> 
> ---------------------------(end of 
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
> 
http://archives.postgresql.org




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

* Re: Driver confused by explicit transactions
@ 2002-12-07 14:00  Hiroshi Inoue <Inoue@tpf.co.jp>
  parent: Glen Parker <glenebob@nwlink.com>
  1 sibling, 1 reply; 5+ messages in thread

From: Hiroshi Inoue @ 2002-12-07 14:00 UTC (permalink / raw)
  To: Glen Parker <glenebob@nwlink.com>; +Cc: pgsql-odbc

> -----Original Message-----
> From: Glen Parker
> 
> It appears there is a somewhat on-going bug in the ODBC driver
> (07.02.0005 in this case) concerning explicit transactions.  The
> following sequence demonstrates it.

What do you mean by explicit transactions ? i. e
 
> Begin transaction   (OK)

   How do you begin the transaction ?

> Execute update statement(s)   (OK, records hidden from other
> transactions)
> Commit transaction    (OK, records appear to other transactions)

  And how do you commit the transaction ?

regards,
Hiroshi Inoue



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

* Re: Driver confused by explicit transactions
@ 2002-12-07 23:27  Glen Parker <glenebob@nwlink.com>
  parent: Hiroshi Inoue <Inoue@tpf.co.jp>
  0 siblings, 1 reply; 5+ messages in thread

From: Glen Parker @ 2002-12-07 23:27 UTC (permalink / raw)
  To: 'Hiroshi Inoue' <Inoue@tpf.co.jp>; pgsql-odbc

> > It appears there is a somewhat on-going bug in the ODBC driver
> > (07.02.0005 in this case) concerning explicit transactions.  The
> > following sequence demonstrates it.
> 
> What do you mean by explicit transactions ? i. e
>  
> > Begin transaction   (OK)
> 
>    How do you begin the transaction ?

By turning off auto-commit with a call to SQLSetConnectOption().
 
> > Execute update statement(s)   (OK, records hidden from other
> > transactions)
> > Commit transaction    (OK, records appear to other transactions)
> 
>   And how do you commit the transaction ?

With a call to SQLTransact() to either commit or abort transaction.

Glen




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

* Re: Driver confused by explicit transactions
@ 2002-12-08 00:51  Hiroshi Inoue <Inoue@tpf.co.jp>
  parent: Glen Parker <glenebob@nwlink.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Hiroshi Inoue @ 2002-12-08 00:51 UTC (permalink / raw)
  To: Glen Parker <glenebob@nwlink.com>; +Cc: pgsql-odbc

> -----Original Message-----
> From: Glen Parker [mailto:glenebob@nwlink.com]
> 
> > > It appears there is a somewhat on-going bug in the ODBC driver
> > > (07.02.0005 in this case) concerning explicit transactions.  The
> > > following sequence demonstrates it.
> > 
> > What do you mean by explicit transactions ? i. e
> >  
> > > Begin transaction   (OK)
> > 
> >    How do you begin the transaction ?
> 
> By turning off auto-commit with a call to SQLSetConnectOption().
>  
> > > Execute update statement(s)   (OK, records hidden from other
> > > transactions)
> > > Commit transaction    (OK, records appear to other transactions)
> > 
> >   And how do you commit the transaction ?
> 
> With a call to SQLTransact() to either commit or abort transaction.

Should SQLTransact() turn on auto-commit ?

regards,
Hiroshi Inoue



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


end of thread, other threads:[~2002-12-08 00:51 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2002-12-06 23:47 Driver confused by explicit transactions Glen Parker <glenebob@nwlink.com>
2002-12-07 00:28 ` Glen Parker <glenebob@nwlink.com>
2002-12-07 14:00 ` Hiroshi Inoue <Inoue@tpf.co.jp>
2002-12-07 23:27   ` Glen Parker <glenebob@nwlink.com>
2002-12-08 00:51     ` Hiroshi Inoue <Inoue@tpf.co.jp>

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