deferred => $item{'deferred'},
reference_table => $desc->{'reference_table'},
reference_fields => $desc->{'reference_fields'},
- match_type => $desc->{'match_type'}[0],
+ match_type => $desc->{'match_type'},
on_delete => $desc->{'on_delete'} || $desc->{'on_delete_do'},
on_update => $desc->{'on_update'} || $desc->{'on_update_do'},
comments => [ @comments ],
deferred : /initially/i /(deferred|immediate)/i { $item[2] }
-match_type : /match full/i { 'match_full' }
- |
- /match partial/i { 'match_partial' }
+match_type : /match/i /partial|full|simple/i { $item[2] }
key_action : key_delete
|
=head2 match_type
Get or set the constraint's match_type. Only valid values are "full"
-or "partial."
+"partial" and "simple"
my $match_type = $constraint->match_type('FULL');
if ( $arg ) {
$arg = lc $arg;
return $self->error("Invalid match type: $arg")
- unless $arg eq 'full' || $arg eq 'partial';
+ unless $arg eq 'full' || $arg eq 'partial' || $arg eq 'simple';
$self->{'match_type'} = $arg;
}
use Test::SQL::Translator qw(maybe_plan);
BEGIN {
- maybe_plan(120, 'SQL::Translator::Parser::PostgreSQL');
+ maybe_plan(122, 'SQL::Translator::Parser::PostgreSQL');
SQL::Translator::Parser::PostgreSQL->import('parse');
}
alter table only t_test1 add constraint c_u1 unique (f_varchar);
alter table t_test1 add constraint "c_fk2" foreign key (f_fk2)
- references t_test2 (f_id) on update no action on delete cascade;
+ references t_test2 (f_id) match simple
+ on update no action on delete cascade deferrable;
+
alter table t_test1 drop column f_dropped restrict;
is( join(',', $c4->reference_fields), 'f_id', 'Constraint is to field "f_id"' );
is( $c4->on_delete, 'cascade', 'On delete: cascade' );
is( $c4->on_update, 'no_action', 'On delete: no action' );
+is( $c4->match_type, 'simple', 'Match type: simple' );
+is( $c4->deferrable, 1, 'Deferrable detected' );
my $t2 = shift @tables;
is( $t2->name, 't_test2', 'Table t_test2 exists' );