Branch Coverage

blib/lib/SQL/Translator/Producer/PostgreSQL.pm
Criterion Covered Total %
branch 172 244 70.4


line true false branch
123 133 160 if exists $options->{'generator'}
125 83 77 normalize_quote_options($options) ? :
238 0 6 unless $no_comments
276 4 2 if (@fks)
277 0 4 unless $no_comments
281 0 6 if ($WARN)
282 0 0 if (%truncated)
290 2 4 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 202 if $field->data_type eq "geometry"
341 0 0 if $field->data_type eq "geography"
355 0 20 unless my $table_name = $table->name
360 2 18 unless $no_comments
363 1 19 if (my $comments = $table->comments)
364 1 0 if ($attach_comments) { }
0 0 elsif (not $no_comments) { }
387 1 60 if ($attach_comments)
389 0 1 unless $field_comments
406 4 0 if $idef
423 16 4 if ($add_drop_table)
424 0 16 if ($postgres_version >= 8.002) { }
430 0 20 $table->extra->{'temporary'} ? :
435 4 16 @index_defs ? :
436 4 16 $create_statement =~ /;$/ ? :
442 1 19 if (my(@geometry_columns) = grep({is_geometry($_);} $table->get_fields))
443 0 1 if $options->{'add_drop_table'}
447 1 19 if (@comment_statements)
465 0 9 unless $options->{'no_comments'}
466 6 3 if ($add_drop_view)
467 1 5 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 8 1 if (my(@fields) = $view->fields)
485 9 0 if (my $sql = $view->sql)
489 1 8 if ($extra->{'check_option'})
515 4 85 if (not $attach_comments and my $comments = $field->comments)
530 2 87 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 33 56 unless $field->is_nullable
565 3 86 if (is_geometry($field))
623 0 15 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 13 $_ =~ /\(.*\)/ ? :
649 0 15 if ($type eq 'PRIMARY KEY') { }
1 14 elsif ($type eq 'UNIQUE') { }
14 0 elsif ($type eq 'NORMAL') { }
661 0 0 if $WARN
683 0 64 if not @fields and $c->type ne "CHECK"
684 40 24 $name ? :
685 4 46 $_ =~ /\(.*\)/ ? :
686 15 49 if ($c->type eq 'PRIMARY KEY') { }
14 35 elsif ($c->type eq 'UNIQUE') { }
18 17 elsif ($c->type eq 'CHECK') { }
7 10 elsif ($c->type eq 'FOREIGN KEY') { }
700 7 0 if (@rfields)
704 0 7 if ($c->match_type)
705 0 0 ' MATCH ' . $c->match_type =~ /full/i ? :
709 0 7 if ($c->on_delete)
713 0 7 if ($c->on_update)
717 7 0 if ($c->deferrable)
734 12 0 if $options->{'add_drop_trigger'}
737 0 12 if $scope
760 0 131 if ($data_type eq 'enum') { }
0 131 elsif ($data_type eq 'set') { }
17 114 elsif ($field->is_auto_increment) { }
773 2 15 if (defined $size[0] and $size[0] > 11 or $data_type eq 'bigint') { }
783 57 57 defined $translate{lc $data_type} ? :
787 12 119 if ($data_type =~ /^time/i or $data_type =~ /^interval/i)
788 1 11 if (defined $size[0] and $size[0] > 6)
793 16 115 if ($data_type eq "integer")
794 14 2 if (defined $size[0] and $size[0] > 0) { }
795 10 4 if ($size[0] > 10) { }
0 4 elsif ($size[0] < 5) { }
815 56 75 unless ($data_type =~ /$type_with_size/)
819 5 126 if (defined $size[0] and $size[0] > 0 and $data_type =~ /^time/i) { }
64 118 elsif (defined $size[0] and $size[0] > 0) { }
821 5 0 if defined $2
825 1 130 if ($array)
833 1 130 if ($data_type eq "geography")
845 0 22 if $from_field->table->name ne $to_field->table->name
852 1 21 if is_geometry($from_field)
862 3 19 if $from_field->name ne $to_field->name
871 6 16 if not $to_field->is_nullable and $from_field->is_nullable
879 4 18 if not $from_field->is_nullable and $to_field->is_nullable
890 10 12 if $to_dt ne $from_dt
905 1 21 if (ref $default_value eq 'SCALAR') { }
3 32 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 21 if not defined $new_default and defined $old_default
933 1 21 if is_geometry($to_field)
938 14 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' ? :
1062 2 12 if ($c->type eq "NOT NULL")
1070 9 3 if ($c->name) { }
1076 1 2 if ($c->type eq 'FOREIGN KEY') { }
2 0 elsif ($c->type eq 'PRIMARY KEY') { }
1100 0 14 unless @{$defs;} or @{$fks;}
1103 1 13 $index->type eq 'FOREIGN KEY' ? :
1114 1 2 if @geometry_drops
1122 10 2 if (@{$diff_hash->{'rename_table'};} == 0)
1140 0 0 if $_->[0]->table($table)
1142 0 0 if $_->[0]->table($table)