Re: [pgadmin-hackers] altering table properties

2005-09-23 Thread Miha Radej

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

---(end of broadcast)---
TIP 4: Have you searched our list archives?

  http://archives.postgresql.org


Re: [pgadmin-hackers] altering table properties

2005-09-23 Thread Dave Page
 

 -Original Message-
 From: [EMAIL PROTECTED] 
 [mailto:[EMAIL PROTECTED] On Behalf Of Miha Radej
 Sent: 23 September 2005 13:14
 To: PgAdmin Hackers
 Subject: [pgadmin-hackers] altering table properties
 
 hi!
 
 thank you for fixing the sql query order in svn. i have, however, 
 noticed some other things which might be annoying:
 
 when wanting to change a table name and a column name at the 
 same time, 
 pgadmin produces this (this is all done via the properties 
 option from 
 the context menu):
 
 ALTER Table budgettype RENAME TO budget_type;
 ALTER TABLE budgettype RENAME budgettype_name  TO budget_type_name;

Fixed in SVN.

Thanks, Dave

---(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