[vhffs-dev] [449] On some restored databases, constraints are named following the $X scheme.

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 449
Author:   beuss
Date:     2007-02-15 21:15:57 +0000 (Thu, 15 Feb 2007)

Log Message:
-----------
On some restored databases, constraints are named following the $X scheme. We need to quote constraint name.

Modified Paths:
--------------
    branches/vhffs_4.1/vhffs-compat/updatedb.pl


Modified: branches/vhffs_4.1/vhffs-compat/updatedb.pl
===================================================================
--- branches/vhffs_4.1/vhffs-compat/updatedb.pl	2007-02-15 20:15:22 UTC (rev 448)
+++ branches/vhffs_4.1/vhffs-compat/updatedb.pl	2007-02-15 21:15:57 UTC (rev 449)
@@ -146,7 +146,7 @@
 
 foreach(@$fk) {
     print "\tDropping $_->{table}($_->{constraint})\n";
-    $dbh->do("ALTER TABLE $_->{table} DROP CONSTRAINT $_->{constraint} CASCADE") or warn "Unable to drop constraint $_->{constraint}\n";
+    $dbh->do("ALTER TABLE $_->{table} DROP CONSTRAINT \"$_->{constraint}\" CASCADE") or warn "Unable to drop constraint $_->{constraint}\n";
 }
 
 print " done.\nLet's drop unique key constraints\n";
@@ -155,7 +155,7 @@
 
 foreach(@$uc) {
     print "\tDropping $_->{table}($_->{constraint})\n";
-    $dbh->do("ALTER TABLE $_->{table} DROP CONSTRAINT $_->{constraint} CASCADE") or warn "Unable to drop constraint $_->{constraint}\n";
+    $dbh->do("ALTER TABLE $_->{table} DROP CONSTRAINT \"$_->{constraint}\" CASCADE") or warn "Unable to drop constraint $_->{constraint}\n";
 }
 
 print " done.\nLet's drop indexes\n";
@@ -164,7 +164,7 @@
 
 foreach(@$idx) {
     print "\tDropping index $_->{index}\n";
-    $dbh->do("DROP INDEX $_->{index}") or warn "Unable to drop index $_->{index}\n";
+    $dbh->do("DROP INDEX \"$_->{index}\"") or warn "Unable to drop index $_->{index}\n";
 }
 
 print " done.\n";


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/