Re: altering table properties - Mailing list pgadmin-hackers

From Miha Radej
Subject Re: altering table properties
Date
Msg-id 4333F4A5.9080909@siix.com
Whole thread Raw
In response to altering table properties  (Miha Radej <miha.radej@siix.com>)
List pgadmin-hackers
hi again!

Miha Radej wrote:
> also, i wanted to remove a constraint (primary key) and add a new one
> and pgadmin produced thie following code:
>
>  CONSTRAINT ALTER TABLE budget_type DROP CONSTRAINT pkey_budgettype;
> ALTER TABLE budget_type ADDpkey_budget_type PRIMARY KEY (id);
>
>
> there is an unneccesary " CONSTRAINT " in front of the first query and
> in the second query there is no space between the ADD keyword and
> constraint name.

i tried fiddling with the code (never touched c++ before so i was a bit
afraid i'd mess things up) and a small change fixed this specific issue,
here is the svn diff:

Index: src/dlg/dlgTable.cpp
===================================================================
--- src/dlg/dlgTable.cpp        (revision 4459)
+++ src/dlg/dlgTable.cpp        (working copy)
@@ -377,7 +377,7 @@
                  tmpsql += wxT("ALTER TABLE ") + tabname
                      +  wxT(" ADD");
                  if (!conname.IsEmpty())
-                    sql += wxT(" CONSTRAINT ");
+                    tmpsql += wxT(" CONSTRAINT ");

                  tmpsql += definition + wxT(";\n");
              }


cheers,
Miha

pgadmin-hackers by date:

Previous
From: Miha Radej
Date:
Subject: altering table properties
Next
From: svn@pgadmin.org
Date:
Subject: SVN Commit by dpage: r4460 - trunk/pgadmin3/src/dlg