Skip to content

Commit 3686bcb

Browse files
committed
Ooops, fix to Genbki.pm for ROWTYPE_OID wasn't quite right. Also, make a few
spacing tweaks so it produces exactly the same output as genbki.sh.
1 parent 12d8fae commit 3686bcb

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

src/tools/msvc/Genbki.pm

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
#
1212
#
1313
# IDENTIFICATION
14-
# $PostgreSQL: pgsql/src/tools/msvc/Genbki.pm,v 1.7 2009/09/26 22:42:03 tgl Exp $
14+
# $PostgreSQL: pgsql/src/tools/msvc/Genbki.pm,v 1.8 2009/09/27 02:14:04 tgl Exp $
1515
#
1616
#-------------------------------------------------------------------------
1717

@@ -30,12 +30,12 @@ sub genbki
3030
my $version = shift;
3131
my $prefix = shift;
3232

33-
$version =~ /^(\d+\.\d+)/ || die "Bad format verison $version\n";
33+
$version =~ /^(\d+\.\d+)/ || die "Bad format version $version\n";
3434
my $majorversion = $1;
3535

3636
my $pgauthid = read_file("src/include/catalog/pg_authid.h");
3737
$pgauthid =~ /^#define\s+BOOTSTRAP_SUPERUSERID\s+(\d+)$/mg
38-
|| die "Could not read BOOTSTRAUP_SUPERUSERID from pg_authid.h\n";
38+
|| die "Could not read BOOTSTRAP_SUPERUSERID from pg_authid.h\n";
3939
my $bootstrapsuperuserid = $1;
4040

4141
my $pgnamespace = read_file("src/include/catalog/pg_namespace.h");
@@ -99,7 +99,7 @@ sub genbki
9999
{
100100
$oid = 0;
101101
}
102-
$data =~ s/\s{2,}/ /g;
102+
$data =~ s/\s+/ /g;
103103
$bki .= $data . "\n";
104104
}
105105
elsif ($line =~ /^DESCR\("(.*)"\)$/m)
@@ -125,7 +125,10 @@ sub genbki
125125
}
126126
my $u = $1?" unique":"";
127127
my @fields = split /,/,$2,3;
128-
$fields[2] =~ s/\s{2,}/ /g;
128+
$fields[0] =~ s/\s+//g;
129+
$fields[1] =~ s/\s+//g;
130+
$fields[2] =~ s/\s+/ /g;
131+
$fields[2] =~ s/^\s+//;
129132
$bki .= "declare$u index $fields[0] $fields[1] $fields[2]\n";
130133
}
131134
elsif ($line =~ /^DECLARE_TOAST\((.*)\)$/m)
@@ -136,13 +139,15 @@ sub genbki
136139
$reln_open = 0;
137140
}
138141
my @fields = split /,/,$1;
142+
$fields[1] =~ s/\s+//g;
143+
$fields[2] =~ s/\s+//g;
139144
$bki .= "declare toast $fields[1] $fields[2] on $fields[0]\n";
140145
}
141146
elsif ($line =~ /^BUILD_INDICES/)
142147
{
143148
$bki .= "build indices\n";
144149
}
145-
elsif ($line =~ /^CATALOG\((.*)\)(.*)$/m)
150+
elsif ($line =~ /^CATALOG\(([^)]*)\)(.*)$/m)
146151
{
147152
if ($reln_open)
148153
{
@@ -181,7 +186,7 @@ sub genbki
181186
{
182187

183188
# Last line
184-
$bki .= "create $catalog $oid$bootstrap$shared_relation$without_oids$rowtype_oid\n\t(\n";
189+
$bki .= "create $catalog $oid$bootstrap$shared_relation$without_oids$rowtype_oid\n (\n";
185190
my $first = 1;
186191
for (my $i = 0; $i <= $#attr; $i++)
187192
{
@@ -191,7 +196,7 @@ sub genbki
191196
}
192197
else
193198
{
194-
$bki .= ",\n";
199+
$bki .= " ,\n";
195200
}
196201
$bki .= " " . $attr[$i] . " = " . $types[$i];
197202
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy