DBD::Pg since version 3.0.0 by default only starts using server-side
prepared statements the second time ->execute is called on a given
statement handle.
Unless server-side prepared statements have been disabled (by setting
the threshold to zero), make it use them immediately to avoid parsing
the statement twice.
return $seq_expr;
}
+sub _dbh_execute_for_fetch {
+ #my ($self, $source, $sth, $tuple_status, @extra) = @_;
+
+ # This is used for bulk insert, so make sure we use a server-side
+ # prepared statement from the start, unless it's disabled
+ local $_[2]->{pg_switch_prepared} = 1 if
+ modver_gt_or_eq( 'DBD::Pg', '3.0.0' )
+ and
+ $_[2]->FETCH('pg_switch_prepared') > 0
+ ;
+
+ shift->next::method(@_);
+}
sub sqlt_type {
return 'PostgreSQL';