@@ -105,19 +105,13 @@ func (c TriggerSchema) Change(obj interface{}) {
105105// compareTriggers outputs SQL to make the triggers match between DBs
106106func compareTriggers (conn1 * sql.DB , conn2 * sql.DB ) {
107107 sql := `
108- SELECT tbl .nspname || '.' || tbl .relname AS table_name
109- , t.tgname AS trigger_name
110- , pg_catalog.pg_get_triggerdef(t.oid, true) AS definition
111- , t.tgenabled AS enabled
108+ SELECT n .nspname || '.' || c .relname AS table_name
109+ , t.tgname AS trigger_name
110+ , pg_catalog.pg_get_triggerdef(t.oid, true) AS definition
111+ , t.tgenabled AS enabled
112112 FROM pg_catalog.pg_trigger t
113- INNER JOIN (
114- SELECT c.oid, n.nspname, c.relname
115- FROM pg_catalog.pg_class c
116- JOIN pg_catalog.pg_namespace n ON (n.oid = c.relnamespace AND n.nspname NOT LIKE 'pg_%')
117- WHERE pg_catalog.pg_table_is_visible(c.oid)) AS tbl
118- ON (tbl.oid = t.tgrelid)
119- AND NOT t.tgisinternal
120- ORDER BY 1;
113+ INNER JOIN pg_catalog.pg_class c ON (c.oid = t.tgrelid)
114+ INNER JOIN pg_catalog.pg_namespace n ON (n.oid = c.relnamespace AND n.nspname NOT LIKE 'pg_%');
121115 `
122116
123117 rowChan1 , _ := pgutil .QueryStrings (conn1 , sql )
0 commit comments