Summary
Add a PerlOnJava DBD::Pg compatibility shim backed by the existing
DBD::JDBC infrastructure and a PostgreSQL JDBC driver.
Motivation
PerlOnJava already provides DBI through JDBC and has a working DBD::JDBC
base driver plus a DBD::SQLite DSN-translation shim. However, CPAN modules
that use the conventional dbi:Pg: DSN or declare DBD::Pg currently cannot
use PostgreSQL through PerlOnJava without a native libpq/XS driver.
MetaCPAN lists 83 distributions depending directly on DBD::Pg, including
recent and actively maintained projects such as:
App::Netdisco
DBIx::Auto::Migrate
Lilith
DBIO::PostgreSQL
Mojo::Pg
Yote::SQLObjectStore
DBD::Patroni
IO::Async::Pg
Tapper::Schema
Reverse-dependency evidence:
https://metacpan.org/module/DBD%3A%3APg/requires
Proposed scope
- Add
src/main/perl/lib/DBD/Pg.pm as a PerlOnJava compatibility driver.
- Inherit the common handle implementation from
DBD::JDBC.
- Translate common DSNs such as:
dbi:Pg:dbname=name
dbi:Pg:dbname=name;host=host;port=5432
into PostgreSQL JDBC URLs.
- Preserve standard DBI operations: connect, prepare, execute, fetch,
transactions, metadata, quoting, and error handling.
- Keep the PostgreSQL JDBC connector optional and use the existing
Configure.pl/classpath driver configuration path.
- Add focused DSN and handle tests without requiring a live server, plus an
optional integration suite against PostgreSQL when a JDBC driver and server
are available.
PostgreSQL-specific compatibility
The first milestone should target ordinary DBI consumers. Follow-up work may
be needed for:
- PostgreSQL arrays,
jsonb, bytea, and other type mappings.
COPY operations.
- Notifications and asynchronous queries.
- Server-side prepare behavior.
pg_* database and statement-handle methods.
- PostgreSQL-specific SSL, socket, and connection attributes.
Unsupported PostgreSQL-specific behavior should be reported clearly rather
than silently emulated incorrectly. The shim should not perform broad SQL
rewriting; PostgreSQL SQL semantics should come from the PostgreSQL JDBC
driver.
Acceptance criteria
use DBD::Pg succeeds under PerlOnJava without XS loading.
- Standard
DBI->connect('dbi:Pg:...', ...) reaches the PostgreSQL JDBC
driver.
- A PostgreSQL-backed smoke test exercises schema introspection, prepared
statements, transactions, parameter binding, and error propagation.
- JVM and interpreter backends have equivalent behavior for the shim.
- At least one representative CPAN consumer can connect using its normal
DBD::Pg DSN once PostgreSQL and the JDBC driver are supplied.
Summary
Add a PerlOnJava
DBD::Pgcompatibility shim backed by the existingDBD::JDBCinfrastructure and a PostgreSQL JDBC driver.Motivation
PerlOnJava already provides DBI through JDBC and has a working
DBD::JDBCbase driver plus a
DBD::SQLiteDSN-translation shim. However, CPAN modulesthat use the conventional
dbi:Pg:DSN or declareDBD::Pgcurrently cannotuse PostgreSQL through PerlOnJava without a native libpq/XS driver.
MetaCPAN lists 83 distributions depending directly on
DBD::Pg, includingrecent and actively maintained projects such as:
App::NetdiscoDBIx::Auto::MigrateLilithDBIO::PostgreSQLMojo::PgYote::SQLObjectStoreDBD::PatroniIO::Async::PgTapper::SchemaReverse-dependency evidence:
https://metacpan.org/module/DBD%3A%3APg/requires
Proposed scope
src/main/perl/lib/DBD/Pg.pmas a PerlOnJava compatibility driver.DBD::JDBC.dbi:Pg:dbname=namedbi:Pg:dbname=name;host=host;port=5432into PostgreSQL JDBC URLs.
transactions, metadata, quoting, and error handling.
Configure.pl/classpath driver configuration path.optional integration suite against PostgreSQL when a JDBC driver and server
are available.
PostgreSQL-specific compatibility
The first milestone should target ordinary DBI consumers. Follow-up work may
be needed for:
jsonb,bytea, and other type mappings.COPYoperations.pg_*database and statement-handle methods.Unsupported PostgreSQL-specific behavior should be reported clearly rather
than silently emulated incorrectly. The shim should not perform broad SQL
rewriting; PostgreSQL SQL semantics should come from the PostgreSQL JDBC
driver.
Acceptance criteria
use DBD::Pgsucceeds under PerlOnJava without XS loading.DBI->connect('dbi:Pg:...', ...)reaches the PostgreSQL JDBCdriver.
statements, transactions, parameter binding, and error propagation.
DBD::PgDSN once PostgreSQL and the JDBC driver are supplied.