|
51 | 51 | table_namespace.nspname NOT IN ('pg_catalog', 'information_schema') |
52 | 52 | AND table_namespace.nspname !~ '^pg_toast' |
53 | 53 | AND table_namespace.nspname !~ '^pg_temp' |
54 | | - AND (c.relkind = 'r' OR c.relkind = 'p'); |
| 54 | + AND (c.relkind = 'r' OR c.relkind = 'p') |
| 55 | + -- Exclude tables owned by extensions |
| 56 | + AND NOT EXISTS ( |
| 57 | + SELECT depend.objid |
| 58 | + FROM pg_catalog.pg_depend AS depend |
| 59 | + WHERE |
| 60 | + depend.classid = 'pg_class'::REGCLASS |
| 61 | + AND depend.objid = c.oid |
| 62 | + AND depend.deptype = 'e' |
| 63 | + ); |
55 | 64 |
|
56 | 65 | -- name: GetColumnsForTable :many |
57 | 66 | WITH identity_col_seq AS ( |
@@ -164,7 +173,16 @@ WHERE |
164 | 173 | table_namespace.nspname NOT IN ('pg_catalog', 'information_schema') |
165 | 174 | AND table_namespace.nspname !~ '^pg_toast' |
166 | 175 | AND table_namespace.nspname !~ '^pg_temp' |
167 | | - AND (c.relkind = 'i' OR c.relkind = 'I'); |
| 176 | + AND (c.relkind = 'i' OR c.relkind = 'I') |
| 177 | + -- Exclude indexes of tables's extensions |
| 178 | + AND NOT EXISTS ( |
| 179 | + SELECT depend.objid |
| 180 | + FROM pg_catalog.pg_depend AS depend |
| 181 | + WHERE |
| 182 | + depend.classid = 'pg_class'::REGCLASS |
| 183 | + AND depend.objid = table_c.oid |
| 184 | + AND depend.deptype = 'e' |
| 185 | + ); |
168 | 186 |
|
169 | 187 | -- name: GetCheckConstraints :many |
170 | 188 | SELECT |
|
0 commit comments