Re: DBD::PostgreSQL

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: David Wheeler <david(at)wheeler(dot)net>
Cc: dbi-dev(at)perl(dot)org, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: DBD::PostgreSQL
Date: 2002-11-18 06:15:16
Message-ID: 22797.1037600116@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-interfaces

David Wheeler <david(at)wheeler(dot)net> writes:
> * In DBD::Pg's dbdimp.c, the dbd_db_commit() function attempts a
> commit, and if it's successful, it then starts another transaction. Is
> this the proper behavior? The other DBDs I looked at don't appear to
> BEGIN a new transaction in the dbd_db_commit() function.
> * A similar question applies to dbd_db_rollback(). It does a rollback,
> and then BEGINs a new transaction. Should it be starting another
> transaction there?

Both of these seem pretty bogus to me. Ideally the driver should not
issue a "begin" until the application issues the first command of the
new transaction. Otherwise you get into scenarios where idle
connections are holding open transactions, and ain't nobody gonna be
happy with that.

> (BTW, I can see why preparsing would be necessary here!) Now, if I'm
> understanding this correctly, the PREPARE statement would need to have
> the data types of each of the parameters specified. Is this something
> that's done in other DBI drivers?

Probably not --- the SQL spec seems to think that the server can intuit
appropriate datatypes for each parameter symbol. (Which I suppose may
be true, in a datatype universe as impoverished as the spec's is;
but it won't work for Postgres. Thus we have a nonstandard syntax for
PREPARE.) So you'll probably have to do some driver-specific coding here.

No ideas about your other questions, but I hope the DBI folk can answer.

> Okay, sorry for all the questions. My motivation is to make a new
> PostgreSQL DBI driver that's one of the best DBI drivers around. Any
> help would go a long way toward helping me to reach my goal.

Go to it ;-)

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Christopher Kings-Lynne 2002-11-18 07:15:42 Re: Proposal of hierarchical queries, a la Oracle
Previous Message Bruce Momjian 2002-11-18 05:06:19 Re: FW: PostgreSQL 7.3 Platform Testing

Browse pgsql-interfaces by date

  From Date Subject
Next Message Ian Barwick 2002-11-18 08:32:11 Re: DBD::PostgreSQL
Previous Message Rudy Lippan 2002-11-18 04:26:11 Re: DBD::PostgreSQL