use quote_identifiers for problematic column names
[dbsrgits/DBIx-Class-Fixtures.git] / lib / DBIx / Class / Fixtures.pm
index b2ee16e..eb6ca43 100644 (file)
@@ -23,7 +23,7 @@ our $namespace_counter = 0;
 __PACKAGE__->mk_group_accessors( 'simple' => qw/config_dir
     _inherited_attributes debug schema_class dumped_objects config_attrs/);
 
-our $VERSION = '1.001_031';
+our $VERSION = '1.001032';
 
 $VERSION = eval $VERSION;
 
@@ -1402,7 +1402,13 @@ sub populate {
              $self->msg("- updating sequence $sequence");
             $rs->result_source->storage->dbh_do(sub {
               my ($storage, $dbh, @cols) = @_;
-              $self->msg(my $sql = "SELECT setval('${sequence}', (SELECT max($column) FROM ${table}));");
+              $self->msg(
+                        my $sql = "SELECT setval('${sequence}', (SELECT max("
+                        .$dbh->quote_identifier($column)
+                        .") FROM "
+                        .$dbh->quote_identifier(${table})
+                        ."));"
+                       );
               my $sth = $dbh->prepare($sql);
               my $rv = $sth->execute or die $sth->errstr;
               $self->msg("- $sql");
@@ -1556,12 +1562,18 @@ sub _name_for_source {
 
   Matt S. Trout <mst@shadowcatsystems.co.uk>
 
+  John Napiorkowski <jjnapiork@cpan.org>
+
   Drew Taylor <taylor.andrew.j@gmail.com>
 
   Frank Switalski <fswitalski@gmail.com>
 
   Chris Akins <chris.hexx@gmail.com>
 
+  Tom Bloor <t.bloor@shadowcat.co.uk>
+
+  Samuel Kaufman <skaufman@cpan.org>
+
 =head1 LICENSE
 
   This library is free software under the same license as perl itself