@@ -72,6 +72,7 @@ public ExtractionContext(Catalog catalog, IReadOnlyCollection<string> targetSche
72
72
}
73
73
74
74
protected const string SysTablesFilterPlaceholder = "{SYSTABLE_FILTER}" ;
75
+ protected const string SysObjectFilterPlaceholder = "{SYSOBJECT_FILTER}" ;
75
76
protected const string CatalogPlaceholder = "{CATALOG}" ;
76
77
protected const string SchemaFilterPlaceholder = "{SCHEMA_FILTER}" ;
77
78
@@ -125,6 +126,7 @@ protected virtual void RegisterReplacements(ExtractionContext context)
125
126
{
126
127
context . RegisterReplacement ( SchemaFilterPlaceholder , MakeSchemaFilter ( context ) ) ;
127
128
context . RegisterReplacement ( SysTablesFilterPlaceholder , "1 > 0" ) ;
129
+ context . RegisterReplacement ( SysObjectFilterPlaceholder , "is_ms_shipped = 0" ) ;
128
130
}
129
131
130
132
private ExtractionContext CreateContext ( string catalogName , string [ ] schemaNames )
@@ -303,14 +305,15 @@ private string BuildExtractTablesAndViewsQuery(ExtractionContext context)
303
305
name,
304
306
0 type
305
307
FROM {CATALOG}.sys.tables
306
- WHERE {SYSTABLE_FILTER}
308
+ WHERE {SYSTABLE_FILTER} AND {SYSOBJECT_FILTER}
307
309
UNION
308
310
SELECT
309
311
schema_id,
310
312
object_id,
311
313
name,
312
314
1 type
313
315
FROM {CATALOG}.sys.views
316
+ WHERE {SYSOBJECT_FILTER}
314
317
) AS t
315
318
WHERE t.schema_id {SCHEMA_FILTER}
316
319
ORDER BY t.schema_id, t.object_id" ;
@@ -411,13 +414,14 @@ INNER JOIN (
411
414
object_id,
412
415
0 as type
413
416
FROM {CATALOG}.sys.tables
414
- WHERE {SYSTABLE_FILTER}
417
+ WHERE {SYSTABLE_FILTER} AND {SYSOBJECT_FILTER}
415
418
UNION
416
419
SELECT
417
420
schema_id,
418
421
object_id,
419
422
1 AS type
420
423
FROM {CATALOG}.sys.views
424
+ WHERE {SYSOBJECT_FILTER}
421
425
) AS t ON c.object_id = t.object_id
422
426
LEFT OUTER JOIN {CATALOG}.sys.default_constraints AS dc
423
427
ON c.object_id = dc.parent_object_id
@@ -501,6 +505,7 @@ WHERE seed_value IS NOT NULL
501
505
AND increment_value IS NOT NULL
502
506
AND {SYSTABLE_FILTER}
503
507
AND t.schema_id {SCHEMA_FILTER}
508
+ AND t.{SYSOBJECT_FILTER}
504
509
ORDER BY
505
510
t.schema_id,
506
511
ic.object_id" ;
@@ -560,13 +565,14 @@ INNER JOIN (
560
565
object_id,
561
566
0 AS type
562
567
FROM {CATALOG}.sys.tables
563
- WHERE {SYSTABLE_FILTER}
568
+ WHERE {SYSTABLE_FILTER} AND {SYSOBJECT_FILTER}
564
569
UNION
565
570
SELECT
566
571
schema_id,
567
572
object_id,
568
573
1 AS type
569
574
FROM {CATALOG}.sys.views
575
+ WHERE {SYSOBJECT_FILTER}
570
576
) AS t
571
577
ON i.object_id = t.object_id
572
578
INNER JOIN {CATALOG}.sys.index_columns ic
@@ -839,7 +845,7 @@ INNER JOIN {CATALOG}.sys.indexes AS i
839
845
ON fic.object_id = i.object_id
840
846
AND fi.unique_index_id = i.index_id
841
847
WHERE {SYSTABLE_FILTER}
842
- AND t.schema_id {SCHEMA_FILTER}
848
+ AND t.schema_id {SCHEMA_FILTER} AND t.{SYSOBJECT_FILTER}
843
849
ORDER BY
844
850
t.schema_id,
845
851
fic.object_id,
0 commit comments