my ($schema,$table) = (shift,shift);
my @columns = fetch_columns($schema,$table);
foreach my $column_array ( @columns ) {
+
my $column = $column_array->[0];
- my $col_type = $column_array->[1];
+ my $col_type_original = $column_array->[1];
+ my $col_type = $col_type_original;
my $col_nullable = $column_array->[2];
my $col_default = $column_array->[3];
+ my $col_numeric_precision = $column_array->[4];
+ my $col_numeric_scale = $column_array->[5];
+ my $col_udt_schema = $column_array->[6];
+ my $col_udt_name = $column_array->[7];
+
if (defined $col_default && $col_default =~ /::text/) {
$col_default =~ s/^'(.*)'::text$/$1/;
}
- my $col_numeric_precision = $column_array->[4];
- my $col_numeric_scale = $column_array->[5];
if ($col_type eq 'numeric' && defined $col_numeric_precision) {
$col_type .= "($col_numeric_precision";
if (defined $col_numeric_scale) {
}
$col_type .= ')';
}
+ if ($col_type eq 'USER-DEFINED' && defined $col_udt_schema) {
+ $col_type = "$col_udt_schema.$col_udt_name";
+ }
print "\n-- -- -- column " . $dbh->quote("$schema.$table.$column") . "\n\n";
print "SELECT has_column(\n";
print "\t" . $dbh->quote($schema) . ",\n";
} elsif ($col_type eq 'integer' && $col_default =~ '\(-?\d+\)') {
# FIXME - ERROR: invalid input syntax for integer: "(-1)"
$fixme = '-- FIXME type 4 -- ';
- } elsif ($col_type eq 'USER-DEFINED') {
+ } elsif ($col_type_original eq 'USER-DEFINED') {
# FIXME - ERROR: Unexpected end of string
$fixme = '-- FIXME type 5 -- ';
}
print "\t" . $dbh->quote($schema) . ",\n";
print "\t" . $dbh->quote($view) . ",\n";
print "\t" . $dbh->quote("Has view $schema.$view") . "\n);\n";
-
handle_columns($schema,$view);
}
is_nullable,
column_default,
numeric_precision,
- numeric_scale
+ numeric_scale,
+ udt_schema,
+ udt_name
FROM information_schema.columns
WHERE table_catalog = ?
AND table_schema = ?