pg.ddx.io pgsql-odbc@postgresql.org mailing list archive
help / color / mirror / Atom feedODBC Connection Pooling (Windows 2000 MDAC 2.7 patched, pgodbc-7.02.00.05)
9+ messages / 5 participants
[nested] [flat]
* ODBC Connection Pooling (Windows 2000 MDAC 2.7 patched, pgodbc-7.02.00.05)
@ 2003-08-29 18:53 Chris Gamache <cgg007@yahoo.com>
0 siblings, 1 reply; 9+ messages in thread
From: Chris Gamache @ 2003-08-29 18:53 UTC (permalink / raw)
To: pgsql-odbc
We have a problem where the value of currval() transitions from one pooled
connection to another with pgodbc-7.02.00.05. I am wondering if pgodbc has been
fixed to wipe connection-related variables like currval and nextval when a
pooled connection is recycled. Is there perhaps some setting that I am missing?
Also, I can't find a definitive changelog describing all the various
improvements between 7.02.00.05 and the current stable version. That makes it
difficult to assess the dangers of upgrading!
CG
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: ODBC Connection Pooling (Windows 2000 MDAC 2.7 patched, pgodbc-7.02.00.05)
@ 2003-08-29 19:08 Doug McNaught <doug@mcnaught.org>
parent: Chris Gamache <cgg007@yahoo.com>
0 siblings, 1 reply; 9+ messages in thread
From: Doug McNaught @ 2003-08-29 19:08 UTC (permalink / raw)
To: cgg007@yahoo.com; +Cc: pgsql-odbc
Chris Gamache <cgg007@yahoo.com> writes:
> We have a problem where the value of currval() transitions from one pooled
> connection to another with pgodbc-7.02.00.05. I am wondering if pgodbc has been
> fixed to wipe connection-related variables like currval and nextval when a
> pooled connection is recycled. Is there perhaps some setting that I am missing?
If this happens, your application code is broken. You should always
call nextval() before calling currval() on a given connection. These
are server-side functions (not variables) and the ODBC driver can't
"reset" them.
-Doug
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: ODBC Connection Pooling (Windows 2000 MDAC 2.7 patched, pgodbc-7.02.00.05)
@ 2003-09-02 15:17 Chris Gamache <cgg007@yahoo.com>
parent: Doug McNaught <doug@mcnaught.org>
0 siblings, 1 reply; 9+ messages in thread
From: Chris Gamache @ 2003-09-02 15:17 UTC (permalink / raw)
To: pgsql-odbc
Doug, thanks for the reply!
Bruce, back me up (or shoot me down..): currval() should be undefined when a
connection is first made for any given sequence. If a connection is recycled,
shouldn't currval() be undefined for any given sequence to simulate the
behavior of a connection first being made?
CG
--- Doug McNaught <doug@mcnaught.org> wrote:
> Chris Gamache <cgg007@yahoo.com> writes:
>
> > We have a problem where the value of currval() transitions from one pooled
> > connection to another with pgodbc-7.02.00.05. I am wondering if pgodbc has
> been
> > fixed to wipe connection-related variables like currval and nextval when a
> > pooled connection is recycled. Is there perhaps some setting that I am
> missing?
>
> If this happens, your application code is broken. You should always
> call nextval() before calling currval() on a given connection. These
> are server-side functions (not variables) and the ODBC driver can't
> "reset" them.
>
> -Doug
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: ODBC Connection Pooling (Windows 2000 MDAC 2.7 patched, pgodbc-7.02.00.05)
@ 2003-09-03 21:05 Bruce Momjian <pgman@candle.pha.pa.us>
parent: Chris Gamache <cgg007@yahoo.com>
0 siblings, 1 reply; 9+ messages in thread
From: Bruce Momjian @ 2003-09-03 21:05 UTC (permalink / raw)
To: cgg007@yahoo.com; +Cc: pgsql-odbc
Chris Gamache wrote:
>
> Doug, thanks for the reply!
>
> Bruce, back me up (or shoot me down..): currval() should be undefined when a
> connection is first made for any given sequence. If a connection is recycled,
> shouldn't currval() be undefined for any given sequence to simulate the
> behavior of a connection first being made?
It would be nice if we wiped out currval when a shared connection is
passed. We have added RESET ALL to clear out most SET values, but we
don't have any code to clear currval values.
Is there a reason the person would be calling currval when they haven't
called nextval yet?
---------------------------------------------------------------------------
>
> CG
>
> --- Doug McNaught <doug@mcnaught.org> wrote:
> > Chris Gamache <cgg007@yahoo.com> writes:
> >
> > > We have a problem where the value of currval() transitions from one pooled
> > > connection to another with pgodbc-7.02.00.05. I am wondering if pgodbc has
> > been
> > > fixed to wipe connection-related variables like currval and nextval when a
> > > pooled connection is recycled. Is there perhaps some setting that I am
> > missing?
> >
> > If this happens, your application code is broken. You should always
> > call nextval() before calling currval() on a given connection. These
> > are server-side functions (not variables) and the ODBC driver can't
> > "reset" them.
> >
> > -Doug
> >
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 7: don't forget to increase your free space map settings
>
>
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
>
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
>
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: ODBC Connection Pooling (Windows 2000 MDAC 2.7 patched, pgodbc-7.02.00.05)
@ 2003-09-04 15:29 Chris Gamache <cgg007@yahoo.com>
parent: Bruce Momjian <pgman@candle.pha.pa.us>
0 siblings, 1 reply; 9+ messages in thread
From: Chris Gamache @ 2003-09-04 15:29 UTC (permalink / raw)
To: Bruce Momjian <pgman@candle.pha.pa.us>; pgsql-odbc
If for no other reason that it is reasonable to assume that currval() would be
undefined at the start of a connection, it should be resetable.
<pseudo-code...>
create temporary table t_tbl (id serial, myvalue text);
NOTICE: CREATE TABLE will create implicit sequence 't_tbl_id_seq' for SERIAL
column 't_tbl.id'
NOTICE: CREATE TABLE / UNIQUE will create implicit index 't_tbl_id_key' for
table 't_tbl'
CREATE
begin;
update t_tbl set myvalue='newvalue' where id=currval('t_tbl_id_seq');
UPDATE 0
commit;
COMMIT
if recaff = 0 {
begin;
BEGIN
insert into t_tbl (myvalue) values ('newvalue');
INSERT 253902900 1
commit;
COMMIT
}
</pseudo-code>
If sequences are used to keep track of the row last inserted, isn't it critical
to be able to insure the value of currval() doesn't belong to someone else's
connection?
CG
--- Bruce Momjian <pgman@candle.pha.pa.us> wrote:
> Chris Gamache wrote:
> >
> > Doug, thanks for the reply!
> >
> > Bruce, back me up (or shoot me down..): currval() should be undefined when
> a
> > connection is first made for any given sequence. If a connection is
> recycled,
> > shouldn't currval() be undefined for any given sequence to simulate the
> > behavior of a connection first being made?
>
> It would be nice if we wiped out currval when a shared connection is
> passed. We have added RESET ALL to clear out most SET values, but we
> don't have any code to clear currval values.
>
> Is there a reason the person would be calling currval when they haven't
> called nextval yet?
>
> ---------------------------------------------------------------------------
>
> >
> > CG
> >
> > --- Doug McNaught <doug@mcnaught.org> wrote:
> > > Chris Gamache <cgg007@yahoo.com> writes:
> > >
> > > > We have a problem where the value of currval() transitions from one
> pooled
> > > > connection to another with pgodbc-7.02.00.05. I am wondering if pgodbc
> has
> > > been
> > > > fixed to wipe connection-related variables like currval and nextval
> when a
> > > > pooled connection is recycled. Is there perhaps some setting that I am
> > > missing?
> > >
> > > If this happens, your application code is broken. You should always
> > > call nextval() before calling currval() on a given connection. These
> > > are server-side functions (not variables) and the ODBC driver can't
> > > "reset" them.
> > >
> > > -Doug
> > >
> > >
> > > ---------------------------(end of broadcast)---------------------------
> > > TIP 7: don't forget to increase your free space map settings
> >
> >
> > __________________________________
> > Do you Yahoo!?
> > Yahoo! SiteBuilder - Free, easy-to-use web site design software
> > http://sitebuilder.yahoo.com
> >
> > ---------------------------(end of broadcast)---------------------------
> > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org
> >
>
> --
> Bruce Momjian | http://candle.pha.pa.us
> pgman@candle.pha.pa.us | (610) 359-1001
> + If your life is a hard drive, | 13 Roberts Road
> + Christ can be your backup. | Newtown Square, Pennsylvania 19073
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: ODBC Connection Pooling (Windows 2000 MDAC 2.7 patched,
@ 2003-09-04 18:13 Oliver Elphick <olly@lfix.co.uk>
parent: Chris Gamache <cgg007@yahoo.com>
0 siblings, 1 reply; 9+ messages in thread
From: Oliver Elphick @ 2003-09-04 18:13 UTC (permalink / raw)
To: cgg007@yahoo.com; +Cc: Bruce Momjian <pgman@candle.pha.pa.us>; pgsql-odbc
On Thu, 2003-09-04 at 16:29, Chris Gamache wrote:
> If sequences are used to keep track of the row last inserted, isn't it critical
> to be able to insure the value of currval() doesn't belong to someone else's
> connection?
That can't happen. currval() is _guaranteed_ to return only the last
value generated during your own current session. That is why you cannot
use it unless you have used nextval() first in the same session.
--
Oliver Elphick Oliver.Elphick@lfix.co.uk
Isle of Wight, UK http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
========================================
"If any of you lack wisdom, let him ask of God, who
gives to all men generously and without reproach, and
it will be given to him." James 1:5
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: ODBC Connection Pooling (Windows 2000 MDAC 2.7 patched, pgodbc-7.02.00.05)
@ 2003-09-04 20:54 Chris Gamache <cgg007@yahoo.com>
parent: Oliver Elphick <olly@lfix.co.uk>
0 siblings, 1 reply; 9+ messages in thread
From: Chris Gamache @ 2003-09-04 20:54 UTC (permalink / raw)
To: Oliver Elphick <olly@lfix.co.uk>; +Cc: Bruce Momjian <pgman@candle.pha.pa.us>; pgsql-odbc
That is my point exactly. That is why (windows?) connection pooling breaks this
model. It wouldn't be a problem if there were a way to undefine currval() for
all sequences... It would be a command issued by the ODBC driver when the
connection is made (best), or by the connecting process as its first order of
business (do-able).
CG
--- Oliver Elphick <olly@lfix.co.uk> wrote:
> On Thu, 2003-09-04 at 16:29, Chris Gamache wrote:
>
> > If sequences are used to keep track of the row last inserted, isn't it
> critical
> > to be able to insure the value of currval() doesn't belong to someone
> else's
> > connection?
>
> That can't happen. currval() is _guaranteed_ to return only the last
> value generated during your own current session. That is why you cannot
> use it unless you have used nextval() first in the same session.
>
> --
> Oliver Elphick Oliver.Elphick@lfix.co.uk
> Isle of Wight, UK http://www.lfix.co.uk/oliver
> GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839 932A 614D 4C34 3E1D 0C1C
> ========================================
> "If any of you lack wisdom, let him ask of God, who
> gives to all men generously and without reproach, and
> it will be given to him." James 1:5
>
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: ODBC Connection Pooling (Windows 2000 MDAC 2.7 patched,
@ 2003-09-04 23:49 Hiroshi Inoue <Inoue@tpf.co.jp>
parent: Chris Gamache <cgg007@yahoo.com>
0 siblings, 1 reply; 9+ messages in thread
From: Hiroshi Inoue @ 2003-09-04 23:49 UTC (permalink / raw)
To: cgg007@yahoo.com; +Cc: Oliver Elphick <olly@lfix.co.uk>; Bruce Momjian <pgman@candle.pha.pa.us>; pgsql-odbc
Chris Gamache wrote:
>
> That is my point exactly. That is why (windows?) connection
> pooling breaks this model. It wouldn't be a problem if there
> were a way to undefine currval() for all sequences...
> It would be a command issued by the ODBC driver when the
> connection is made (best), or by the connecting process as
> its first order of business (do-able).
How could the driver know if the connection is recycled ?
SQL..Connect API function isn't called when the connection
is recycled.
regards,
Hiroshi Inoue
http://www.geocities.jp/inocchichichi/psqlodbc/
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: ODBC Connection Pooling (Windows 2000 MDAC 2.7 patched, pgodbc-7.02.00.05)
@ 2003-09-05 16:13 Chris Gamache <cgg007@yahoo.com>
parent: Hiroshi Inoue <Inoue@tpf.co.jp>
0 siblings, 0 replies; 9+ messages in thread
From: Chris Gamache @ 2003-09-05 16:13 UTC (permalink / raw)
To: pgsql-odbc; +Cc: Oliver Elphick <olly@lfix.co.uk>; Bruce Momjian <pgman@candle.pha.pa.us>
Rats... In that case, the application creating the connection would have to
issue a command to the back-end before running any other SQL statements.
--- Hiroshi Inoue <Inoue@tpf.co.jp> wrote:
> Chris Gamache wrote:
> >
> > That is my point exactly. That is why (windows?) connection
> > pooling breaks this model. It wouldn't be a problem if there
> > were a way to undefine currval() for all sequences...
> > It would be a command issued by the ODBC driver when the
> > connection is made (best), or by the connecting process as
> > its first order of business (do-able).
>
> How could the driver know if the connection is recycled ?
> SQL..Connect API function isn't called when the connection
> is recycled.
>
> regards,
> Hiroshi Inoue
> http://www.geocities.jp/inocchichichi/psqlodbc/
__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com
^ permalink raw reply [nested|flat] 9+ messages in thread
end of thread, other threads:[~2003-09-05 16:13 UTC | newest]
Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2003-08-29 18:53 ODBC Connection Pooling (Windows 2000 MDAC 2.7 patched, pgodbc-7.02.00.05) Chris Gamache <cgg007@yahoo.com>
2003-08-29 19:08 ` Doug McNaught <doug@mcnaught.org>
2003-09-02 15:17 ` Chris Gamache <cgg007@yahoo.com>
2003-09-03 21:05 ` Bruce Momjian <pgman@candle.pha.pa.us>
2003-09-04 15:29 ` Chris Gamache <cgg007@yahoo.com>
2003-09-04 18:13 ` Re: ODBC Connection Pooling (Windows 2000 MDAC 2.7 patched, Oliver Elphick <olly@lfix.co.uk>
2003-09-04 20:54 ` Chris Gamache <cgg007@yahoo.com>
2003-09-04 23:49 ` Re: ODBC Connection Pooling (Windows 2000 MDAC 2.7 patched, Hiroshi Inoue <Inoue@tpf.co.jp>
2003-09-05 16:13 ` Chris Gamache <cgg007@yahoo.com>
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