[rt-users] Changing database connection options?

hubert depesz lubaczewski depesz at depesz.com
Sat Dec 11 17:40:17 EST 2010


Hi,
another question: is there any way to change database connections
options from config?
I.e. I want to change what's being passed as 4th argument to
DBI->connect().

Reason for this is pretty simple: I'm using PostgreSQL, and DBD::Pg is
choosing by default to use server side prepared statements. I don't like
them, and would like to disable them, but I'd prefer not to modify RT
source itself, so I was hoping for some way to make it happen from
config.

To show some example.

When $dbh is created like this;

$dbh = DBI->connect( 'dbi:Pg:dbname=xxx', 'yy', 'zz' );

DBD::Pg will use server side prepared statements.

To disable this "feature", one have to either:

$dbh->{pg_server_prepare} = 0;

or:

$dbh = DBI->connect( 'dbi:Pg:dbname=xxx', 'yy', 'zz', { pg_server_prepare => 0 } );

In case you need to know why i want to disable server side prepared
statements:
1. http://www.depesz.com/index.php/2008/05/10/prepared-statements-gotcha/
2. it breaks connection pooling with pgbouncer (and I know I can use
different pooling mode, but "session pooling" is pretty much useless)

Best regards,

depesz

-- 
Linkedin: http://www.linkedin.com/in/depesz  /  blog: http://www.depesz.com/
jid/gtalk: depesz at depesz.com / aim:depeszhdl / skype:depesz_hdl / gg:6749007



More information about the rt-users mailing list