From: Robert Buels Date: Fri, 4 Sep 2009 17:43:08 +0000 (+0000) Subject: tweaked pg sequence discovery error message a bit more X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c20066e6d368bc607bb451332e44debe2d7c6e2b;p=dbsrgits%2FDBIx-Class-Historic.git tweaked pg sequence discovery error message a bit more --- diff --git a/lib/DBIx/Class/Storage/DBI/Pg.pm b/lib/DBIx/Class/Storage/DBI/Pg.pm index 8080b39..61a8d5e 100644 --- a/lib/DBIx/Class/Storage/DBI/Pg.pm +++ b/lib/DBIx/Class/Storage/DBI/Pg.pm @@ -80,17 +80,16 @@ $where EOS - defined $seq_expr and length $seq_expr - or $self->throw_exception( "no sequence found for $table.$col, check table definition, " - . "or explicitly set the 'sequence' for this column in the " - . $source->source_name - . " class" - ); - - unless ( $seq_expr =~ /^nextval\(+'([^']+)'::(?:text|regclass)\)/i ){ + # if no default value is set on the column, or if we can't parse the + # default value as a sequence, throw. + unless ( defined $seq_expr and $seq_expr =~ /^nextval\(+'([^']+)'::(?:text|regclass)\)/i ){ $seq_expr = '' unless defined $seq_expr; - $schema = $schema . "." if defined $schema && length $schema; - $self->throw_exception("could not parse nextval expression for $schema$table.$col: '$seq_expr'"); + $schema = "$schema." if defined $schema && length $schema; + $self->throw_exception( "no sequence found for $schema$table.$col, check table definition, " + . "or explicitly set the 'sequence' for this column in the " + . $source->source_name + . " class" + ); } return $1;