- Add options to omit the version and timestamp from the
generated code (RT#92300)
- Skip dumping unique indexes with expressions (RT#93613)
+ - Fix dumping unique indexes with DBD::Pg < 1.50
0.07039 2014-01-06
- Fix table listing with DBD::DB2 >= 1.85 (RT#91764)
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 = ?}
);
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 ]);
}
}
q{
create table pg_loader_test12 (
id integer not null,
+ value integer,
+ active boolean,
name text
)
},
upper(name), id
)
},
+ q{
+ create unique index pg_loader_test12_value on pg_loader_test12 (
+ value
+ )
+ },
+ q{
+ create unique index pg_loader_test12_name_active on pg_loader_test12 (
+ name
+ ) where active
+ },
],
pre_drop_ddl => [
'DROP SCHEMA dbicsl_test CASCADE',
isa_ok $schema->resultset($monikers->{pg_loader_test11})->result_source, 'DBIx::Class::ResultSource::View',
'views have table_class set correctly';
- is_deeply { $schema->source($monikers->{pg_loader_test12})->unique_constraints },
- {}, 'unique indexes with expressions are not dumped';
+ is_deeply
+ { $schema->source($monikers->{pg_loader_test12})->unique_constraints },
+ { pg_loader_test12_value => ['value'] },
+ 'unique indexes are dumped correctly';
},
},
);