The trigger SQL now also shows the function definition.

This commit is contained in:
eelke 2019-02-09 17:36:37 +01:00
parent 3fdd42ffb2
commit b08bd1a315
2 changed files with 8 additions and 0 deletions

View file

@ -7,6 +7,7 @@
#include "CustomFilterSortModel.h"
#include "CustomDataRole.h"
#include "PgLabTableView.h"
#include "catalog/PgProcContainer.h"
#include <QStringBuilder>
#include <unordered_set>
@ -44,6 +45,11 @@ void TriggerPage::tableView_selectionChanged(const QItemSelection &/*selected*/,
auto&& t = m_model->trigger(rij);
drops += t.dropSql() % "\n";
creates += t.createSql() % "\n";
const PgProc *proc = m_catalog->procs()->getByKey(t.foid);
if (proc) {
creates += "\n" % proc->createSql() % "\n";
}
}
m_definitionView->setPlainText(drops % "\n" % creates);
}

View file

@ -343,7 +343,9 @@ QString PgProc::createSql() const
// sql += wxT("\n")
// + GetGrant(wxT("X"), wxT("FUNCTION ") + qtSig);
sql += "\n";
sql += alterOwnerSql("FUNCTION " + quoted_sig);
sql += "\n";
sql += grantSql();
// if (!GetComment().IsNull())