Branch Coverage

blib/lib/SQL/Translator/Producer/PostgreSQL.pm
Criterion Covered Total %
branch 183 258 70.9


line true false branch
125 159 166 if exists $options->{'generator'}
127 86 80 normalize_quote_options($options) ? :
237 0 8 unless $no_comments
286 5 3 if (@fks)
287 0 5 unless $no_comments
292 1 7 if ($WARN)
293 0 1 if (%truncated)
301 2 6 wantarray ? :
314 0 0 $type ? :
318 0 0 if length $basename > $max_name
320 0 0 $type ? :
322 0 0 if ($basename ne $basename_orig and $critical)
323 0 0 $type ? :
324 0 0 if $WARN
330 0 0 if (my $prev = $scope->{$name})
333 0 0 if length $name > 62
336 0 0 if $WARN
349 10 230 if $field->data_type eq "geometry"
354 0 0 if $field->data_type eq "geography"
367 0 24 unless my $table_name = $table->name
372 2 22 unless $no_comments
375 1 23 if (my $comments = $table->comments)
376 1 0 if ($attach_comments) { }
0 0 elsif (not $no_comments) { }
404 12 62 if ($attach_comments)
406 10 2 unless $field_comments
425 5 0 if $idef
444 20 4 if ($add_drop_table)
445 0 20 if ($postgres_version >= 8.002) { }
451 0 24 $table->extra->{'temporary'} ? :
454 5 19 @index_defs ? :
455 5 19 $create_statement =~ /;$/ ? :
460 1 23 if (my(@geometry_columns) = grep({is_geometry($_);} $table->get_fields))
462 0 1 if $options->{'add_drop_table'}
466 2 22 if (@comment_statements)
484 0 10 unless $options->{'no_comments'}
485 7 3 if ($add_drop_view)
486 1 6 if ($postgres_version >= 8.002) { }
496 1 0 if exists $extra->{'temporary'} and $extra->{'temporary'}
498 1 0 if exists $extra->{'materialized'} and $extra->{'materialized'}
501 9 1 if (my(@fields) = $view->fields)
506 10 0 if (my $sql = $view->sql)
510 1 9 if ($extra->{'check_option'})
520 4 144 if (ref $field->extra->{'list'} eq "ARRAY")
521 3 1 if ($field->extra->{'custom_type_name'}) { }
1 0 elsif ($field->data_type eq 'enum') { }
549 4 98 if (not $attach_comments and my $comments = $field->comments)
563 2 100 if ($postgres_version >= 8.003 and $enum_typename) { }
568 2 0 if (not exists $type_defs->{$enum_typename}) { }
0 0 elsif ($type_defs->{$enum_typename} ne $new_type_def) { }
593 38 64 unless $field->is_nullable
598 3 99 if (is_geometry($field))
646 7 0 if (ref $opt eq "HASH")
649 0 8 unless defined $val
673 0 18 unless @fields
683 1 1 unless $postgres_version >= 11
684 0 1 unless ref $value eq "ARRAY"
693 6 16 $_ =~ /\(.*\)/ ? :
694 0 18 if ($type eq 'PRIMARY KEY') { }
1 17 elsif ($type eq 'UNIQUE') { }
17 0 elsif ($type eq 'NORMAL') { }
704 0 0 if $WARN
727 0 0 unless $postgres_version >= 11
728 0 0 unless ref $value eq "ARRAY"
742 0 19 if not @fields and ($c->type ne "CHECK" and $c->type ne "EXCLUDE")
743 43 27 $name ? :
744 4 51 $_ =~ /\(.*\)/ ? :
746 17 53 if ($c->type eq 'PRIMARY KEY') { }
16 37 elsif ($c->type eq 'UNIQUE') { }
18 19 elsif ($c->type eq 'CHECK') { }
8 11 elsif ($c->type eq 'FOREIGN KEY') { }
1 10 elsif ($c->type eq 'EXCLUDE') { }
759 8 0 if (@rfields)
763 0 8 if ($c->match_type)
764 0 0 ' MATCH ' . $c->match_type =~ /full/i ? :
767 0 8 if ($c->on_delete)
771 0 8 if ($c->on_update)
775 8 0 if ($c->deferrable)
797 14 0 if $options->{'add_drop_trigger'}
800 2 12 if $scope
822 2 144 if ($data_type eq 'enum') { }
0 144 elsif ($data_type eq 'set') { }
19 125 elsif ($field->is_auto_increment) { }
834 2 17 if (defined $size[0] and $size[0] > 11 or $data_type eq 'bigint') { }
843 65 60 defined $translate{lc $data_type} ? :
847 13 133 if ($data_type =~ /^time/i or $data_type =~ /^interval/i)
848 1 12 if (defined $size[0] and $size[0] > 6)
853 17 129 if ($data_type eq "integer")
854 15 2 if (defined $size[0] and $size[0] > 0) { }
855 10 5 if ($size[0] > 10) { }
0 5 elsif ($size[0] < 5) { }
871 60 86 unless ($data_type =~ /$type_with_size/)
875 5 141 if (defined $size[0] and $size[0] > 0 and $data_type =~ /^time/i) { }
69 132 elsif (defined $size[0] and $size[0] > 0) { }
877 5 0 if defined $2
881 1 145 if ($array)
888 1 145 if ($data_type eq "geography")
898 0 23 if $from_field->table->name ne $to_field->table->name
905 1 22 if is_geometry($from_field)
913 3 20 if $from_field->name ne $to_field->name
918 6 17 if not $to_field->is_nullable and $from_field->is_nullable
923 4 19 if not $from_field->is_nullable and $to_field->is_nullable
930 10 13 if $to_dt ne $from_dt
937 1 0 if ($from_enum_typename and $to_enum_typename and $from_enum_typename eq $to_enum_typename)
946 0 1 if not $pg_ver_ok and @add_vals
949 1 0 $pg_ver_ok ? :
953 0 1 if @del_vals
963 1 22 if (ref $default_value eq 'SCALAR') { }
3 34 elsif (defined $default_value and $to_dt =~ /^(character|text|timestamp|date)/imsx) { }
970 5 3 if defined $new_default and !defined($old_default) || $old_default ne $new_default
982 1 22 if not defined $new_default and defined $old_default
988 1 22 if is_geometry($to_field)
991 14 9 wantarray ? :
1004 1 5 if is_geometry($new_field)
1020 1 3 if is_geometry($old_field)
1038 1 4 $options->{'table'} ? :
1068 1 2 if $options->{'geometry_changes'}
1081 1 2 if @geometry_changes
1091 0 1 $index->type eq 'NORMAL' ? :
1106 2 12 if ($c->type eq "NOT NULL")
1114 9 3 if ($c->name) { }
1121 1 2 if ($c->type eq 'FOREIGN KEY') { }
2 0 elsif ($c->type eq 'PRIMARY KEY') { }
1144 0 14 unless @{$defs;} or @{$fks;}
1147 1 13 $index->type eq 'FOREIGN KEY' ? :
1158 1 2 if @geometry_drops
1166 10 2 if (@{$diff_hash->{'rename_table'};} == 0)
1185 0 0 if $_->[0]->table($table)
1186 0 0 if $_->[0]->table($table)