summaryrefslogtreecommitdiff
path: root/maintenance/postgres/compare_schemas.pl
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2007-09-14 13:18:58 +0200
committerPierre Schmitz <pierre@archlinux.de>2007-09-14 13:18:58 +0200
commit8f416baead93a48e5799e44b8bd2e2c4859f4e04 (patch)
treecd47ac55eb80a39e3225e8b4f3161b88ea16c2cf /maintenance/postgres/compare_schemas.pl
parentd7d08bd1a17618c7d77a6b9b2989e9f7293d6ed6 (diff)
auf Version 1.11 aktualisiert; Login-Bug behoben
Diffstat (limited to 'maintenance/postgres/compare_schemas.pl')
-rw-r--r--maintenance/postgres/compare_schemas.pl14
1 files changed, 11 insertions, 3 deletions
diff --git a/maintenance/postgres/compare_schemas.pl b/maintenance/postgres/compare_schemas.pl
index ce045fef..297e3af2 100644
--- a/maintenance/postgres/compare_schemas.pl
+++ b/maintenance/postgres/compare_schemas.pl
@@ -35,7 +35,7 @@ while (<DATA>) {
my $datatype = join '|' => qw(
bool
tinyint int bigint real float
-tinytext mediumtext text char varchar varbinary
+tinytext mediumtext text char varchar varbinary binary
timestamp datetime
tinyblob mediumblob blob
);
@@ -155,7 +155,7 @@ CIDR
);
$dtype = qr{($dtype)};
my %new;
-my ($infunction,$inview,$inrule) = (0,0,0);
+my ($infunction,$inview,$inrule,$lastcomma) = (0,0,0,0);
seek $newfh, 0, 0;
while (<$newfh>) {
next if /^\s*\-\-/ or /^\s*$/;
@@ -190,11 +190,19 @@ while (<$newfh>) {
if (/^CREATE TABLE "?(\w+)"? \($/) {
$table = $1;
$new{$table}{name}=$table;
+ $lastcomma = 1;
}
elsif (/^\);$/) {
+ if ($lastcomma) {
+ warn "Stray comma before line $.\n";
+ }
}
- elsif (/^ (\w+) +$dtype/) {
+ elsif (/^ (\w+) +$dtype.*?(,?)(?: --.*)?$/) {
$new{$table}{column}{$1} = $2;
+ if (!$lastcomma) {
+ print "Missing comma before line $. of $new\n";
+ }
+ $lastcomma = $3 ? 1 : 0;
}
else {
die "Cannot parse line $. of $new:\n$_\n";