X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader%2FDBI%2FPg.pm;h=6623a7380da30228b1c82e330d3d9e4c77b1eb8e;hb=802a117545a5bd1a5d20152835a3aa7fb2e7b39f;hp=02885d86256c31c1fb2ccc793419ffc5e768ed17;hpb=8a9cc3bb69bee00efb91480ed7106a9bdf473414;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm b/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm index 02885d8..6623a73 100644 --- a/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm +++ b/lib/DBIx/Class/Schema/Loader/DBI/Pg.pm @@ -5,7 +5,7 @@ use warnings; use base 'DBIx::Class::Schema::Loader::DBI::Component::QuotedDefault'; use mro 'c3'; -our $VERSION = '0.07037'; +our $VERSION = '0.07041'; =head1 NAME @@ -125,15 +125,15 @@ sub _table_uniq_info { pg_catalog.pg_index x JOIN pg_catalog.pg_class c ON c.oid = x.indrelid JOIN pg_catalog.pg_class i ON i.oid = x.indexrelid - JOIN pg_catalog.pg_constraint con ON con.conname = i.relname - LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace + JOIN pg_catalog.pg_namespace n ON n.oid = c.relnamespace WHERE x.indisunique = 't' AND + x.indpred IS NULL AND c.relkind = 'r' AND i.relkind = 'i' AND - con.contype = 'u' AND n.nspname = ? AND - c.relname = ?} + c.relname = ? + ORDER BY i.relname} ); $uniq_sth->execute($table->schema, $table->name); @@ -149,10 +149,8 @@ sub _table_uniq_info { push(@col_names, $self->_lc($name_aref->[0])) if $name_aref; } - if(!@col_names) { - warn "Failed to parse UNIQUE constraint $indexname on $table"; - } - else { + # skip indexes with missing column names (e.g. expression indexes) + if(@col_names == @col_nums) { push(@uniqs, [ $indexname => \@col_names ]); } }