Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Save new comments on already existing columns when editing a table

If I use the object browser context menu for an existing table and
choose "Properties...', I get a dialog that looks identical to dialog
for creating the table.  It allows me to add a new column to the table
just like in the table creation case, and it asks for a comment on the
new column.  But that comment gets thrown away.  The SQL tab reflects
the ALTER TABLE statement to add the column, but not the additional
statement to record the comment on that new column.

This patch fixes this. Unfortunately, it has a side-effect. When someone
changes a column property (but not the comment), and the column already had a
comment, it adds a COMMENT query with the old comment. So it's one useless
query. Not a big deal, and fixing this would be a huge work.

Per a report from Jeff Janes.
  • Loading branch information...
commit 18621d9a8f445ddf8541414d5177a78b754083c9 1 parent ea8fcb2
@gleu gleu authored
Showing with 8 additions and 9 deletions.
  1. +2 −0  CHANGELOG
  2. +6 −9 pgadmin/dlg/dlgTable.cpp
View
2  CHANGELOG
@@ -37,6 +37,8 @@ Changes
Date Dev Ver Change details
---------- --- ------ --------------
+2012-11-29 GL 1.16.1 Save new comments on already existing columns when
+ editing a table. Per a report from Jeff Janes.
2012-11-29 GL 1.16.1 Fix the query editor behaviour when executing COPY TO
stdout and COPY FROM stdin [Heikki Linnakangas]
2012-11-28 AV 1.16.1 Date picker controls returns a full timestamp by
View
15 pgadmin/dlg/dlgTable.cpp
@@ -1433,16 +1433,13 @@ wxString dlgTable::GetSql()
}
// Comments
- if (!table)
+ for (pos = 0 ; pos < lstColumns->GetItemCount() ; pos++)
{
- for (pos = 0 ; pos < lstColumns->GetItemCount() ; pos++)
- {
- if (!lstColumns->GetText(pos, COL_COMMENTS).IsEmpty())
- sql += wxT("COMMENT ON COLUMN ") + tabname
- + wxT(".") + qtIdent(lstColumns->GetText(pos, COL_NAME))
- + wxT(" IS ") + qtDbString(lstColumns->GetText(pos, COL_COMMENTS))
- + wxT(";\n");
- }
+ if (!lstColumns->GetText(pos, COL_COMMENTS).IsEmpty())
+ sql += wxT("COMMENT ON COLUMN ") + tabname
+ + wxT(".") + qtIdent(lstColumns->GetText(pos, COL_NAME))
+ + wxT(" IS ") + qtDbString(lstColumns->GetText(pos, COL_COMMENTS))
+ + wxT(";\n");
}
AppendComment(sql, wxT("TABLE ") + qtIdent(cbSchema->GetValue()) + wxT(".") + qtIdent(GetName()), table);
Please sign in to comment.
Something went wrong with that request. Please try again.