Index: trunk/phase3/maintenance/postgres/compare_schemas.pl |
— | — | @@ -155,7 +155,7 @@ |
156 | 156 | ); |
157 | 157 | $dtype = qr{($dtype)}; |
158 | 158 | my %new; |
159 | | -my ($infunction,$inview,$inrule) = (0,0,0); |
| 159 | +my ($infunction,$inview,$inrule,$lastcomma) = (0,0,0,0); |
160 | 160 | seek $newfh, 0, 0; |
161 | 161 | while (<$newfh>) { |
162 | 162 | next if /^\s*\-\-/ or /^\s*$/; |
— | — | @@ -190,11 +190,19 @@ |
191 | 191 | if (/^CREATE TABLE "?(\w+)"? \($/) { |
192 | 192 | $table = $1; |
193 | 193 | $new{$table}{name}=$table; |
| 194 | + $lastcomma = 1; |
194 | 195 | } |
195 | 196 | elsif (/^\);$/) { |
| 197 | + if ($lastcomma) { |
| 198 | + warn "Stray comma before line $.\n"; |
| 199 | + } |
196 | 200 | } |
197 | | - elsif (/^ (\w+) +$dtype/) { |
| 201 | + elsif (/^ (\w+) +$dtype.*?(,?)(?: --.*)?$/) { |
198 | 202 | $new{$table}{column}{$1} = $2; |
| 203 | + if (!$lastcomma) { |
| 204 | + print "Missing comma before line $. of $new\n"; |
| 205 | + } |
| 206 | + $lastcomma = $3 ? 1 : 0; |
199 | 207 | } |
200 | 208 | else { |
201 | 209 | die "Cannot parse line $. of $new:\n$_\n"; |