fix the type numeric tests
authorJason Etheridge <jason@esilibrary.com>
Tue, 23 Jul 2013 19:01:41 +0000 (15:01 -0400)
committerJason Etheridge <jason@esilibrary.com>
Tue, 23 Jul 2013 19:01:41 +0000 (15:01 -0400)
Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Open-ILS/src/sql/Pg/make-pgtap-tests.pl

index 7241818..2271b8f 100755 (executable)
@@ -66,6 +66,15 @@ foreach my $schema ( @schemas ) {
             my $col_type = $column_array->[1];
             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];
+            if ($col_type eq 'numeric' && defined $col_numeric_precision) {
+                $col_type .= "($col_numeric_precision";
+                if (defined $col_numeric_scale) {
+                    $col_type .= ",$col_numeric_scale";
+                }
+                $col_type .= ')';
+            }
             print "\n-- -- -- column " . $dbh->quote("$schema.$table.$column") . "\n\n";
             print "SELECT has_column(\n";
             print "\t" . $dbh->quote($schema) . ",\n";
@@ -208,7 +217,9 @@ sub fetch_columns {
             column_name,
             data_type,
             is_nullable,
-            column_default
+            column_default,
+            numeric_precision,
+            numeric_scale
         FROM information_schema.columns
             WHERE table_catalog = ?
             AND table_schema = ?