Branch Coverage

blib/lib/SQL/Translator/Producer/PostgreSQL.pm
Criterion Covered Total %
branch 174 242 71.9


line true false branch
123 159 157 if exists $options->{'generator'}
125 83 74 normalize_quote_options($options) ? :
238 0 8 unless $no_comments
276 5 3 if (@fks)
277 0 5 unless $no_comments
281 1 7 if ($WARN)
282 0 1 if (%truncated)
290 2 6 wantarray ? :
302 0 0 $type ? :
305 0 0 if length $basename > $max_name
307 0 0 $type ? :
309 0 0 if ($basename ne $basename_orig and $critical)
310 0 0 $type ? :
311 0 0 if $WARN
317 0 0 if (my $prev = $scope->{$name})
320 0 0 if length $name > 62
323 0 0 if $WARN
336 10 224 if $field->data_type eq "geometry"
341 0 0 if $field->data_type eq "geography"
355 0 24 unless my $table_name = $table->name
360 2 22 unless $no_comments
363 1 23 if (my $comments = $table->comments)
364 1 0 if ($attach_comments) { }
0 0 elsif (not $no_comments) { }
387 12 62 if ($attach_comments)
389 10 2 unless $field_comments
406 5 0 if $idef
423 20 4 if ($add_drop_table)
424 0 20 if ($postgres_version >= 8.002) { }
430 0 24 $table->extra->{'temporary'} ? :
435 5 19 @index_defs ? :
436 5 19 $create_statement =~ /;$/ ? :
442 1 23 if (my(@geometry_columns) = grep({is_geometry($_);} $table->get_fields))
443 0 1 if $options->{'add_drop_table'}
447 2 22 if (@comment_statements)
465 0 10 unless $options->{'no_comments'}
466 7 3 if ($add_drop_view)
467 1 6 if ($postgres_version >= 8.002) { }
476 1 0 if exists $extra->{'temporary'} and $extra->{'temporary'}
477 1 0 if exists $extra->{'materialized'} and $extra->{'materialized'}
480 9 1 if (my(@fields) = $view->fields)
485 10 0 if (my $sql = $view->sql)
489 1 9 if ($extra->{'check_option'})
515 4 98 if (not $attach_comments and my $comments = $field->comments)
530 2 100 if ($postgres_version >= 8.003 and $data_type eq 'enum') { }
535 2 0 if (not exists $type_defs->{$type_name}) { }
0 0 elsif ($type_defs->{$type_name} ne $new_type_def) { }
560 38 64 unless $field->is_nullable
565 3 99 if (is_geometry($field))
623 0 16 unless @fields
627 6 0 if (ref $opt eq "HASH")
630 0 6 unless defined $value
631 2 4 if (uc $key eq 'USING') { }
2 2 elsif (uc $key eq 'WHERE') { }
2 0 elsif (uc $key eq 'INCLUDE') { }
638 1 1 unless $postgres_version >= 11
639 0 1 unless ref $value eq "ARRAY"
648 6 14 $_ =~ /\(.*\)/ ? :
649 0 16 if ($type eq 'PRIMARY KEY') { }
1 15 elsif ($type eq 'UNIQUE') { }
15 0 elsif ($type eq 'NORMAL') { }
661 0 0 if $WARN
683 0 69 if not @fields and $c->type ne "CHECK"
684 42 27 $name ? :
685 4 51 $_ =~ /\(.*\)/ ? :
686 17 52 if ($c->type eq 'PRIMARY KEY') { }
16 36 elsif ($c->type eq 'UNIQUE') { }
18 18 elsif ($c->type eq 'CHECK') { }
8 10 elsif ($c->type eq 'FOREIGN KEY') { }
700 8 0 if (@rfields)
704 0 8 if ($c->match_type)
705 0 0 ' MATCH ' . $c->match_type =~ /full/i ? :
709 0 8 if ($c->on_delete)
713 0 8 if ($c->on_update)
717 8 0 if ($c->deferrable)
734 14 0 if $options->{'add_drop_trigger'}
737 2 12 if $scope
760 0 140 if ($data_type eq 'enum') { }
0 140 elsif ($data_type eq 'set') { }
19 121 elsif ($field->is_auto_increment) { }
773 2 17 if (defined $size[0] and $size[0] > 11 or $data_type eq 'bigint') { }
783 65 56 defined $translate{lc $data_type} ? :
787 13 127 if ($data_type =~ /^time/i or $data_type =~ /^interval/i)
788 1 12 if (defined $size[0] and $size[0] > 6)
793 17 123 if ($data_type eq "integer")
794 15 2 if (defined $size[0] and $size[0] > 0) { }
795 10 5 if ($size[0] > 10) { }
0 5 elsif ($size[0] < 5) { }
815 60 80 unless ($data_type =~ /$type_with_size/)
819 5 135 if (defined $size[0] and $size[0] > 0 and $data_type =~ /^time/i) { }
65 130 elsif (defined $size[0] and $size[0] > 0) { }
821 5 0 if defined $2
825 1 139 if ($array)
833 1 139 if ($data_type eq "geography")
845 0 20 if $from_field->table->name ne $to_field->table->name
852 1 19 if is_geometry($from_field)
862 3 17 if $from_field->name ne $to_field->name
871 6 14 if not $to_field->is_nullable and $from_field->is_nullable
879 2 18 if not $from_field->is_nullable and $to_field->is_nullable
890 10 10 if $to_dt ne $from_dt
905 1 19 if (ref $default_value eq 'SCALAR') { }
3 28 elsif (defined $default_value and $to_dt =~ /^(character|text|timestamp|date)/imsx) { }
911 5 3 if defined $new_default and !defined($old_default) || $old_default ne $new_default
924 1 19 if not defined $new_default and defined $old_default
933 1 19 if is_geometry($to_field)
938 12 8 wantarray ? :
950 1 5 if is_geometry($new_field)
966 1 3 if is_geometry($old_field)
984 1 4 $options->{'table'} ? :
1022 1 2 if $options->{'geometry_changes'}
1036 1 2 if @geometry_changes
1045 0 1 $index->type eq 'NORMAL' ? :
1065 9 2 if ($c->name) { }
1 1 elsif ($c->type eq 'FOREIGN KEY') { }
1 0 elsif ($c->type eq 'PRIMARY KEY') { }
1091 0 14 unless @{$defs;} or @{$fks;}
1094 1 13 $index->type eq 'FOREIGN KEY' ? :
1105 1 2 if @geometry_drops
1113 10 2 if (@{$diff_hash->{'rename_table'};} == 0)
1131 0 0 if $_->[0]->table($table)
1133 0 0 if $_->[0]->table($table)