PostgreSQL allows perl stored procedures to be created. This module will provide access to the PostgreSQL database from inside your stored procedure.
- It exports a dbh named $pg_dbh, which you may use at any time. You can also explicitly do DBI->connect("dbi:PgSPI:internal"), but it is essentially a no-op. DBI->disconnect is also not necessary, you will be will disconnected from SPI by plperl handler, when your stored proc ends.
- It requires DBD::Pg for operation. DBD::Pg is used to execute table_info(), tables(), table_attributes(), type_info_all(). (No actual access is done using it or libpq, only the queries in DBD::Pg are used, to avoid duplication of code).
- It can only be used with 'untrusted' perl interpreter (since trusted interpreter will not permit modules or anything like that). 'untrusted' plperl is NOT part of latest (7.1) distribution, you must use HEAD CVS branch or patch on http://www.formenos.org/PgSPI/plperlu.diff
- Large objects (BLOBs, lo_open style) are not supported, and probably won't be.
- Since PostgreSQL (current version) does not support nested transactions, this driver will not let you turn off AutoCommit.
- Beware of quoting. Remember, all single quotes inside stored procedure need to be doubled.