Revert TempExtlib ( b46b85376 ) - new Sub::Quote shipped
[dbsrgits/DBIx-Class-Historic.git] / lib / DBIx / Class / Storage / DBI / Pg.pm
index 87a237d..a8fd85b 100644 (file)
@@ -157,11 +157,40 @@ EOS
   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';
 }
 
+# Pg is not able to MAX(boolean_column), sigh...
+#
+# Generally it would make more sense to have this in the SQLMaker hierarchy,
+# so that eventually { -max => ... } DTRT, but plans going forward are
+# murky at best
+#   --ribasushi
+#
+sub _minmax_operator_for_datatype {
+  #my ($self, $datatype, $want_max) = @_;
+
+  return ($_[2] ? 'BOOL_OR' : 'BOOL_AND')
+    if ($_[1] || '') =~ /\Abool(?:ean)?\z/i;
+
+  shift->next::method(@_);
+}
+
 sub bind_attribute_by_data_type {
   my ($self,$data_type) = @_;