@@ -72,6 +72,7 @@ public ExtractionContext(Catalog catalog, IReadOnlyCollection<string> targetSche
7272 }
7373
7474 protected const string SysTablesFilterPlaceholder = "{SYSTABLE_FILTER}" ;
75+ protected const string SysObjectFilterPlaceholder = "{SYSOBJECT_FILTER}" ;
7576 protected const string CatalogPlaceholder = "{CATALOG}" ;
7677 protected const string SchemaFilterPlaceholder = "{SCHEMA_FILTER}" ;
7778
@@ -125,6 +126,7 @@ protected virtual void RegisterReplacements(ExtractionContext context)
125126 {
126127 context . RegisterReplacement ( SchemaFilterPlaceholder , MakeSchemaFilter ( context ) ) ;
127128 context . RegisterReplacement ( SysTablesFilterPlaceholder , "1 > 0" ) ;
129+ context . RegisterReplacement ( SysObjectFilterPlaceholder , "is_ms_shipped = 0" ) ;
128130 }
129131
130132 private ExtractionContext CreateContext ( string catalogName , string [ ] schemaNames )
@@ -303,14 +305,15 @@ private string BuildExtractTablesAndViewsQuery(ExtractionContext context)
303305 name,
304306 0 type
305307 FROM {CATALOG}.sys.tables
306- WHERE {SYSTABLE_FILTER}
308+ WHERE {SYSTABLE_FILTER} AND {SYSOBJECT_FILTER}
307309 UNION
308310 SELECT
309311 schema_id,
310312 object_id,
311313 name,
312314 1 type
313315 FROM {CATALOG}.sys.views
316+ WHERE {SYSOBJECT_FILTER}
314317 ) AS t
315318 WHERE t.schema_id {SCHEMA_FILTER}
316319 ORDER BY t.schema_id, t.object_id" ;
@@ -411,13 +414,14 @@ INNER JOIN (
411414 object_id,
412415 0 as type
413416 FROM {CATALOG}.sys.tables
414- WHERE {SYSTABLE_FILTER}
417+ WHERE {SYSTABLE_FILTER} AND {SYSOBJECT_FILTER}
415418 UNION
416419 SELECT
417420 schema_id,
418421 object_id,
419422 1 AS type
420423 FROM {CATALOG}.sys.views
424+ WHERE {SYSOBJECT_FILTER}
421425 ) AS t ON c.object_id = t.object_id
422426 LEFT OUTER JOIN {CATALOG}.sys.default_constraints AS dc
423427 ON c.object_id = dc.parent_object_id
@@ -501,6 +505,7 @@ WHERE seed_value IS NOT NULL
501505 AND increment_value IS NOT NULL
502506 AND {SYSTABLE_FILTER}
503507 AND t.schema_id {SCHEMA_FILTER}
508+ AND t.{SYSOBJECT_FILTER}
504509 ORDER BY
505510 t.schema_id,
506511 ic.object_id" ;
@@ -560,13 +565,14 @@ INNER JOIN (
560565 object_id,
561566 0 AS type
562567 FROM {CATALOG}.sys.tables
563- WHERE {SYSTABLE_FILTER}
568+ WHERE {SYSTABLE_FILTER} AND {SYSOBJECT_FILTER}
564569 UNION
565570 SELECT
566571 schema_id,
567572 object_id,
568573 1 AS type
569574 FROM {CATALOG}.sys.views
575+ WHERE {SYSOBJECT_FILTER}
570576 ) AS t
571577 ON i.object_id = t.object_id
572578 INNER JOIN {CATALOG}.sys.index_columns ic
@@ -839,7 +845,7 @@ INNER JOIN {CATALOG}.sys.indexes AS i
839845 ON fic.object_id = i.object_id
840846 AND fi.unique_index_id = i.index_id
841847 WHERE {SYSTABLE_FILTER}
842- AND t.schema_id {SCHEMA_FILTER}
848+ AND t.schema_id {SCHEMA_FILTER} AND t.{SYSOBJECT_FILTER}
843849 ORDER BY
844850 t.schema_id,
845851 fic.object_id,
0 commit comments