From: hatorikibble Date: Mon, 30 Nov 2015 20:01:21 +0000 (+0100) Subject: use quote_identifiers for problematic column names X-Git-Tag: v1.00103_3~1^2~1 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=deba97cc4ec71e943119f7cdd3e0d777b60ffffc;p=dbsrgits%2FDBIx-Class-Fixtures.git use quote_identifiers for problematic column names --- diff --git a/lib/DBIx/Class/Fixtures.pm b/lib/DBIx/Class/Fixtures.pm index 574ec3a..eb6ca43 100644 --- a/lib/DBIx/Class/Fixtures.pm +++ b/lib/DBIx/Class/Fixtures.pm @@ -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");