Ooops, fix to Genbki.pm for ROWTYPE_OID wasn't quite right. Also, make a few
authorTom Lane <[email protected]>
Sun, 27 Sep 2009 02:14:04 +0000 (02:14 +0000)
committerTom Lane <[email protected]>
Sun, 27 Sep 2009 02:14:04 +0000 (02:14 +0000)
spacing tweaks so it produces exactly the same output as genbki.sh.

src/tools/msvc/Genbki.pm

index f41a20de4d6f1f7b468f7478589ee24708739564..da46197cda5278be24bd28fc18267bf26055be77 100644 (file)
@@ -30,12 +30,12 @@ sub genbki
     my $version = shift;
     my $prefix = shift;
 
-    $version =~ /^(\d+\.\d+)/ || die "Bad format verison $version\n";
+    $version =~ /^(\d+\.\d+)/ || die "Bad format version $version\n";
     my $majorversion = $1;
 
     my $pgauthid = read_file("src/include/catalog/pg_authid.h");
     $pgauthid =~ /^#define\s+BOOTSTRAP_SUPERUSERID\s+(\d+)$/mg
-      || die "Could not read BOOTSTRAUP_SUPERUSERID from pg_authid.h\n";
+      || die "Could not read BOOTSTRAP_SUPERUSERID from pg_authid.h\n";
     my $bootstrapsuperuserid = $1;
 
     my $pgnamespace = read_file("src/include/catalog/pg_namespace.h");
@@ -99,7 +99,7 @@ sub genbki
             {
                 $oid = 0;
             }
-            $data =~ s/\s{2,}/ /g;
+            $data =~ s/\s+/ /g;
             $bki .= $data . "\n";
         }
         elsif ($line =~ /^DESCR\("(.*)"\)$/m)
@@ -125,7 +125,10 @@ sub genbki
             }
             my $u = $1?" unique":"";
             my @fields = split /,/,$2,3;
-            $fields[2] =~ s/\s{2,}/ /g;
+            $fields[0] =~ s/\s+//g;
+            $fields[1] =~ s/\s+//g;
+            $fields[2] =~ s/\s+/ /g;
+            $fields[2] =~ s/^\s+//;
             $bki .= "declare$u index $fields[0] $fields[1] $fields[2]\n";
         }
         elsif ($line =~ /^DECLARE_TOAST\((.*)\)$/m)
@@ -136,13 +139,15 @@ sub genbki
                 $reln_open = 0;
             }
             my @fields = split /,/,$1;
+            $fields[1] =~ s/\s+//g;
+            $fields[2] =~ s/\s+//g;
             $bki .= "declare toast $fields[1] $fields[2] on $fields[0]\n";
         }
         elsif ($line =~ /^BUILD_INDICES/)
         {
             $bki .= "build indices\n";
         }
-        elsif ($line =~ /^CATALOG\((.*)\)(.*)$/m)
+        elsif ($line =~ /^CATALOG\(([^)]*)\)(.*)$/m)
         {
             if ($reln_open)
             {
@@ -181,7 +186,7 @@ sub genbki
             {
 
                 # Last line
-                $bki .= "create $catalog $oid$bootstrap$shared_relation$without_oids$rowtype_oid\n\t(\n";
+                $bki .= "create $catalog $oid$bootstrap$shared_relation$without_oids$rowtype_oid\n (\n";
                 my $first = 1;
                 for (my $i = 0; $i <= $#attr; $i++)
                 {
@@ -191,7 +196,7 @@ sub genbki
                     }
                     else
                     {
-                        $bki .= ",\n";
+                        $bki .= " ,\n";
                     }
                     $bki .= " " . $attr[$i] . " = " . $types[$i];
                 }