Skip to content

Commit c9c8905

Browse files
authored
Merge pull request #42 from jdavisp3/no-internal-triggers
Do not diff internal triggers
2 parents 894e1bf + 7747cd9 commit c9c8905

File tree

4 files changed

+3
-11
lines changed

4 files changed

+3
-11
lines changed

function.go

-4
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ func (c *FunctionSchema) Compare(obj interface{}) int {
108108

109109
// Add returns SQL to create the function
110110
func (c FunctionSchema) Add() {
111-
fmt.Println("-- Add")
112-
113111
// If we are comparing two different schemas against each other, we need to do some
114112
// modification of the first function definition so we create it in the right schema
115113
functionDef := c.get("definition")
@@ -128,7 +126,6 @@ func (c FunctionSchema) Add() {
128126

129127
// Drop returns SQL to drop the function
130128
func (c FunctionSchema) Drop() {
131-
fmt.Println("-- Drop")
132129
fmt.Println("-- Note that CASCADE in the statement below will also drop any triggers depending on this function.")
133130
fmt.Println("-- Also, if there are two functions with this name, you will want to add arguments to identify the correct one to drop.")
134131
fmt.Println("-- (See http://www.postgresql.org/docs/9.4/interactive/sql-dropfunction.html) ")
@@ -137,7 +134,6 @@ func (c FunctionSchema) Drop() {
137134

138135
// Change handles the case where the function names match, but the definition does not
139136
func (c FunctionSchema) Change(obj interface{}) {
140-
fmt.Println("-- Change")
141137
c2, ok := obj.(*FunctionSchema)
142138
if !ok {
143139
fmt.Println("Error!!!, Change needs a FunctionSchema instance", c2)

grant_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ func doParseAcls(t *testing.T, acl string, expectedRole string, expectedPermCoun
2020
t.Error("Wrong role parsed: " + role + " instead of " + expectedRole)
2121
}
2222
if len(perms) != expectedPermCount {
23-
t.Error("Incorrect number of permissions parsed: %d instead of %d", len(perms), expectedPermCount)
23+
t.Errorf("Incorrect number of permissions parsed: %d instead of %d", len(perms), expectedPermCount)
2424
}
2525
}

pgdiff.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,7 @@ Options:
203203
-S, --schema1 : first schema. default is all schemas
204204
-s, --schema2 : second schema. default is all schemas
205205
206-
<schemaTpe> can be: SCHEMA ROLE, SEQUENCE, TABLE, VIEW, COLUMN, INDEX, FOREIGN_KEY, OWNER, GRANT_RELATIONSHIP, GRANT_ATTRIBUTE
207-
`)
206+
<schemaTpe> can be: ALL, SCHEMA, ROLE, SEQUENCE, TABLE, VIEW, COLUMN, INDEX, FOREIGN_KEY, OWNER, GRANT_RELATIONSHIP, GRANT_ATTRIBUTE, TRIGGER, FUNCTION`)
208207

209208
os.Exit(2)
210209
}

trigger.go

+1-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func initTriggerSqlTemplate() *template.Template {
3333
FROM pg_catalog.pg_trigger t
3434
INNER JOIN pg_catalog.pg_class c ON (c.oid = t.tgrelid)
3535
INNER JOIN pg_catalog.pg_namespace n ON (n.oid = c.relnamespace)
36-
WHERE true
36+
WHERE not t.tgisinternal
3737
{{if eq $.DbSchema "*" }}
3838
AND n.nspname NOT LIKE 'pg_%'
3939
AND n.nspname <> 'information_schema'
@@ -106,8 +106,6 @@ func (c *TriggerSchema) Compare(obj interface{}) int {
106106

107107
// Add returns SQL to create the trigger
108108
func (c TriggerSchema) Add() {
109-
fmt.Println("-- Add")
110-
111109
// If we are comparing two different schemas against each other, we need to do some
112110
// modification of the first trigger definition so we create it in the right schema
113111
triggerDef := c.get("trigger_def")
@@ -131,7 +129,6 @@ func (c TriggerSchema) Drop() {
131129

132130
// Change handles the case where the trigger names match, but the definition does not
133131
func (c TriggerSchema) Change(obj interface{}) {
134-
fmt.Println("-- Change")
135132
c2, ok := obj.(*TriggerSchema)
136133
if !ok {
137134
fmt.Println("Error!!!, Change needs a TriggerSchema instance", c2)

0 commit comments

Comments
 (0)