[pg-devel] plans for v3 protocol
Eric Marsden
emarsden at laas.fr
Wed Mar 3 14:13:33 UTC 2004
Hi,
pg-dot-lisp currently supports only the v2 frontend/backend protocol,
which is implemented by PostgreSQL versions up to and including 7.3.
Version 7.4 introduces a new v3 protocol, which is more pleasant in
several aspects:
- better error reporting, with various fields including the type of
the message, instead of a simple error string. This should allow
us to improve the mapping onto Common Lisp conditions, by
introducing more error classes
- allowing prebound queries with placeholder values (improved
efficiency for certain use-cases)
- more regular protocol, so cleaner implementation
The new protocol has been introduced in a backward-compatible manner,
and v7.4 backends are still able to talk the old version of the
protocol, so the current pg-dot-lisp code works fine with PostgreSQL
7.4, though without profiting from these benefits.
Peter Van Eynde has implemented the v3 protocol in Common Lisp. To
integrate this with the current pg-dot-lisp code base, while retaining
compatibility with older PostgreSQL versions, my plan is the
following:
- create PGCON-V2 and PGCON-V3 classes
- modify PG-CONNECT to negociate the highest protocol version
supported by the backend, and return either a PGCON-V2 or
PGCON-V3 object
- change PG-EXEC, FN and PG-DISCONNECT to be generic functions
dispatching on the type of their first argument
- split out the v2 protocol code from pg.lisp into
protocol-v2.lisp, and add PVE's code as protocol-v3.lisp
Hopefully this will get us the best of both worlds without too much
pain. I suspect there will be remaining problems with the error
handling, which may have to be separated according to the protocol
version; we'll see.
[Grr, it seems that posting via the NNTP interface doesn't propagate
to the mailing list ...]
--
Eric Marsden <URL:http://www.laas.fr/~emarsden/>
More information about the pg-devel
mailing list