Author: dpage
Date: 2005-09-23 13:50:47 +0100 (Fri, 23 Sep 2005)
New Revision: 4461

Modified:
   trunk/pgadmin3/src/dlg/dlgProperty.cpp
   trunk/pgadmin3/src/dlg/dlgTable.cpp
Log:
Further fixes to table modification SQL

Modified: trunk/pgadmin3/src/dlg/dlgProperty.cpp
===================================================================
--- trunk/pgadmin3/src/dlg/dlgProperty.cpp      2005-09-23 12:38:25 UTC (rev 
4460)
+++ trunk/pgadmin3/src/dlg/dlgProperty.cpp      2005-09-23 12:50:47 UTC (rev 
4461)
@@ -310,7 +310,7 @@
                                +  wxT(" RENAME TO ") + qtIdent(GetName())
                                +  wxT(";\n");
                } else {
-                       sql += wxT("ALTER ") + GetObject()->GetTypeName()
+                       sql += wxT("ALTER ") + 
GetObject()->GetTypeName().MakeUpper()
                    +  wxT(" ") + GetObject()->GetQuotedFullIdentifier()
                                +  wxT(" RENAME TO ") + qtIdent(GetName())
                                +  wxT(";\n");

Modified: trunk/pgadmin3/src/dlg/dlgTable.cpp
===================================================================
--- trunk/pgadmin3/src/dlg/dlgTable.cpp 2005-09-23 12:38:25 UTC (rev 4460)
+++ trunk/pgadmin3/src/dlg/dlgTable.cpp 2005-09-23 12:50:47 UTC (rev 4461)
@@ -312,9 +312,6 @@
 
         wxString definition;
 
-        AppendNameChange(sql);
-        AppendOwnerChange(sql, wxT("TABLE ") + tabname);
-
         wxArrayString tmpDef=previousColumns;
         wxString tmpsql;
 
@@ -327,7 +324,7 @@
                 definition=qtIdent(lstColumns->GetText(pos)) + wxT(" ") + 
lstColumns->GetText(pos, 1);
                 index=tmpDef.Index(definition);
                 if (index < 0)
-                    tmpsql += wxT("ALTER TABLE ") + tabname
+                    tmpsql += wxT("ALTER TABLE ") + 
table->GetQuotedFullIdentifier()
                         +  wxT(" ADD COLUMN ") + definition + wxT(";\n");
             }
             else
@@ -353,12 +350,15 @@
                 definition = definition.Mid(1).BeforeFirst('"');
             else
                 definition = definition.BeforeFirst(' ');
-            sql += wxT("ALTER TABLE ") + tabname
+            sql += wxT("ALTER TABLE ") + table->GetQuotedFullIdentifier()
                 +  wxT(" DROP COLUMN ") + qtIdent(definition) + wxT(";\n");
         }
         // Add the ADD COLUMNs...
         sql += tmpsql;
 
+        AppendNameChange(sql);
+        AppendOwnerChange(sql, wxT("TABLE ") + tabname);
+
         tmpDef=previousConstraints;
         tmpsql.Empty();
 


---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to