Skip to content
This repository has been archived by the owner on Sep 15, 2022. It is now read-only.

Commit

Permalink
Include the comment SQL for constraints in the table SQL, per Erwin.
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.pgadmin.org/trunk@6601 a7884b65-44f6-0310-8a51-81a127f17b15
  • Loading branch information
dpage committed Sep 3, 2007
1 parent 06ad47f commit 476a9bb
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pgadmin/schema/pgTable.cpp
Expand Up @@ -155,7 +155,7 @@ void pgTable::AppendStuff(wxString &sql, ctlTree *browser, pgaFactory &factory)

wxString pgTable::GetSql(ctlTree *browser)
{
wxString colDetails;
wxString colDetails, conDetails;
wxString prevComment;

if (sql.IsNull())
Expand Down Expand Up @@ -229,6 +229,10 @@ wxString pgTable::GetSql(ctlTree *browser)
+ wxT(" ") ;

prevComment = data->GetComment();
if (!data->GetComment().IsEmpty())
conDetails += wxT("COMMENT ON CONSTRAINT ") + data->GetQuotedIdentifier() +
wxT(" ON ") + GetQuotedFullIdentifier() +
wxT(" IS ") + qtDbString(data->GetComment()) + wxT(";\n");

switch (data->GetMetaType())
{
Expand Down Expand Up @@ -285,8 +289,12 @@ wxString pgTable::GetSql(ctlTree *browser)

sql += GetCommentSql();

// Column comments
sql += colDetails + wxT("\n");
// Column/constraint comments
if (!colDetails.IsEmpty())
sql += colDetails + wxT("\n");

if (!conDetails.IsEmpty())
sql += conDetails + wxT("\n");

AppendStuff(sql, browser, indexFactory);
AppendStuff(sql, browser, ruleFactory);
Expand Down

0 comments on commit 476a9bb

Please sign in to comment.