X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FStorage%2FDBI%2FPg.pm;h=a6648087824bb1314f801939cec0ab023366ab82;hb=2eef86336a37040fc939429b1003cd93e7c0a360;hp=4e1b50187377537c906497a76582f8ed341c24a2;hpb=ef131d82b1a6cad5ef079a341912b0c6d8b7b990;p=dbsrgits%2FDBIx-Class-Historic.git diff --git a/lib/DBIx/Class/Storage/DBI/Pg.pm b/lib/DBIx/Class/Storage/DBI/Pg.pm index 4e1b501..a664808 100644 --- a/lib/DBIx/Class/Storage/DBI/Pg.pm +++ b/lib/DBIx/Class/Storage/DBI/Pg.pm @@ -50,10 +50,18 @@ sub _dbh_get_autoinc_seq { sub get_autoinc_seq { my ($self,$source,$col) = @_; - + my @pri = $source->primary_columns; - my ($schema,$table) = $source->name =~ /^(.+)\.(.+)$/ ? ($1,$2) - : (undef,$source->name); + + my $schema; + my $table = $source->name; + + if (ref $table eq 'SCALAR') { + $table = $$table; + } + elsif ($table =~ /^(.+)\.(.+)$/) { + ($schema, $table) = ($1, $2); + } $self->dbh_do('_dbh_get_autoinc_seq', $schema, $table, @pri); } @@ -71,7 +79,7 @@ sub bind_attribute_by_data_type { bytea => { pg_type => DBD::Pg::PG_BYTEA }, blob => { pg_type => DBD::Pg::PG_BYTEA }, }; - + if( defined $bind_attributes->{$data_type} ) { return $bind_attributes->{$data_type}; }