Branch Coverage

blib/lib/SQL/Translator/Producer/PostgreSQL.pm
Criterion Covered Total %
branch 161 224 71.8


line true false branch
40 98 152 if exists $options->{'generator'}
42 81 71 normalize_quote_options($options) ? :
154 0 6 unless $no_comments
191 3 3 if (@fks)
192 0 3 unless $no_comments
196 1 5 if ($WARN)
197 0 1 if (%truncated)
205 2 4 wantarray ? :
217 0 0 $type ? :
220 0 0 if length $basename > $max_name
222 0 0 $type ? :
224 0 0 if ($basename ne $basename_orig and $critical)
225 0 0 $type ? :
226 0 0 if $WARN
232 0 0 if (my $prev = $scope->{$name})
235 0 0 if length $name > 62
238 0 0 if $WARN
251 10 168 if $field->data_type eq 'geometry'
256 0 0 if $field->data_type eq 'geography'
269 0 16 unless my $table_name = $table->name
274 2 14 unless $no_comments
276 1 15 if (not $no_comments and my $comments = $table->comments)
300 3 0 if $idef
317 12 4 if ($add_drop_table)
318 0 12 if ($postgres_version >= 8.002) { }
324 0 16 $table->extra->{'temporary'} ? :
329 3 13 @index_defs ? :
330 3 13 $create_statement =~ /;$/ ? :
336 1 15 if (my(@geometry_columns) = grep({is_geometry($_);} $table->get_fields))
337 0 1 if $options->{'add_drop_table'}
355 0 7 unless $options->{'no_comments'}
356 5 2 if ($add_drop_view)
357 1 4 if ($postgres_version >= 8.002) { }
366 1 0 if exists $extra->{'temporary'} and $extra->{'temporary'}
369 6 1 if (my(@fields) = $view->fields)
374 7 0 if (my $sql = $view->sql)
378 1 6 if ($extra->{'check_option'})
402 4 70 if (my $comments = $field->comments)
417 2 72 if ($postgres_version >= 8.003 and $data_type eq 'enum') { }
422 2 0 if (not exists $type_defs->{$type_name}) { }
0 0 elsif ($type_defs->{$type_name} ne $new_type_def) { }
447 28 46 unless $field->is_nullable
452 3 71 if (is_geometry($field))
509 0 12 unless @fields
514 4 0 if (ref $opt eq 'HASH')
517 0 4 unless defined $value
518 2 2 if (uc $key eq 'USING') { }
2 0 elsif (uc $key eq 'WHERE') { }
529 6 10 $_ =~ /\(.*\)/ ? :
530 0 12 if ($type eq 'PRIMARY KEY') { }
1 11 elsif ($type eq 'UNIQUE') { }
11 0 elsif ($type eq 'NORMAL') { }
542 0 0 if $WARN
564 0 54 if not @fields and $c->type ne 'CHECK'
565 38 16 $name ? :
566 4 36 $_ =~ /\(.*\)/ ? :
567 11 43 if ($c->type eq 'PRIMARY KEY') { }
14 29 elsif ($c->type eq 'UNIQUE') { }
18 11 elsif ($c->type eq 'CHECK') { }
6 5 elsif ($c->type eq 'FOREIGN KEY') { }
581 6 0 if (@rfields)
585 0 6 if ($c->match_type)
586 0 0 ' MATCH ' . $c->match_type =~ /full/i ? :
590 0 6 if ($c->on_delete)
594 0 6 if ($c->on_update)
598 6 0 if ($c->deferrable)
615 8 0 if $options->{'add_drop_trigger'}
618 2 6 if $scope
641 0 112 if ($data_type eq 'enum') { }
0 112 elsif ($data_type eq 'set') { }
13 99 elsif ($field->is_auto_increment) { }
654 2 11 if (defined $size[0] and $size[0] > 11 or $data_type eq 'bigint') { }
664 53 46 defined $translate{lc $data_type} ? :
668 11 101 if ($data_type =~ /^time/i or $data_type =~ /^interval/i)
669 1 10 if (defined $size[0] and $size[0] > 6)
674 15 97 if ($data_type eq 'integer')
675 13 2 if (defined $size[0] and $size[0] > 0) { }
676 10 3 if ($size[0] > 10) { }
0 3 elsif ($size[0] < 5) { }
696 48 64 unless ($data_type =~ /$type_with_size/)
700 5 107 if (defined $size[0] and $size[0] > 0 and $data_type =~ /^time/i) { }
51 104 elsif (defined $size[0] and $size[0] > 0) { }
702 5 0 if defined $2
706 1 111 if ($array)
714 1 111 if ($data_type eq 'geography')
726 0 20 if $from_field->table->name ne $to_field->table->name
733 1 19 if is_geometry($from_field)
743 3 17 if $from_field->name ne $to_field->name
752 6 14 if not $to_field->is_nullable and $from_field->is_nullable
760 2 18 if not $from_field->is_nullable and $to_field->is_nullable
771 10 10 if $to_dt ne $from_dt
786 1 19 if (ref $default_value eq 'SCALAR') { }
3 28 elsif (defined $default_value and $to_dt =~ /^(character|text|timestamp|date)/imsx) { }
792 5 3 if defined $new_default and !defined($old_default) || $old_default ne $new_default
805 1 19 if not defined $new_default and defined $old_default
814 1 19 if is_geometry($to_field)
819 12 8 wantarray ? :
831 1 5 if is_geometry($new_field)
847 1 3 if is_geometry($old_field)
865 1 4 $options->{'table'} ? :
903 1 2 if $options->{'geometry_changes'}
917 1 2 if @geometry_changes
926 0 1 $index->type eq 'NORMAL' ? :
946 9 2 if ($c->name) { }
1 1 elsif ($c->type eq 'FOREIGN KEY') { }
1 0 elsif ($c->type eq 'PRIMARY KEY') { }
972 0 14 unless @{$defs;} or @{$fks;}
975 1 13 $index->type eq 'FOREIGN KEY' ? :
986 1 2 if @geometry_drops
994 10 2 if (@{$diff_hash->{'rename_table'};} == 0)
1012 0 0 if $_->[0]->table($table)
1014 0 0 if $_->[0]->table($table)