View Issue Details

IDProjectCategoryView StatusLast Update
0005865SymmetricDSBugpublic2023-07-05 18:26
Reporterrwfuller Assigned ToJishLong  
Prioritynormal 
Status closedResolutionfixed 
Product Version3.14.7 
Target Version3.14.8Fixed in Version3.14.8 
Summary0005865: Estimated count from initial load does not work with SqlServer when using different schema than dbo
DescriptionThe query used to estimate counts for SqlServer is like this

select
    sum(p.rows)
from
    "CATALOG".sys.tables t
inner join "CATALOG".sys.partitions p on
    t.object_id = p.object_id
    and p.index_id IN (0, 1)
where
    t.name = 'TABLE'
    and schema_name(t.schema_id) = 'SCHEMA';

The problem with the query is related to the database in use or current context. It is returning NULL because schema_name function. Schema_name function must be used with a table within the database in use or current context.
Steps To Reproduce1. Install Symmetric in its own catalog
2. Add trigger information for a table where the schema is not dbo
3. Make sure MAX_BATCH_SIZE is less than number of records in source table where it should create multiple batches
3. Create table reload request
4. Initial load will be one batch
Additional InformationCurrent workaround is to set this property to use select count(*) query instead

initial.load.use.estimated.counts=false
Tagsdialect: sql-server, initial/partial load

Activities

pmarzullo

2023-06-14 17:29

developer   ~0002340

consider joining with catalog.sys.schemas(schema_id) to get the schema name from the sys.schemas view.

Related Changesets

SymmetricDS: 3.14 6afa5242

2023-07-05 14:54:41

JishLong

Details Diff
0005865: Estimated count from initial load does not work with SqlServer
when using different schema than dbo
Affected Issues
0005865
mod - symmetric-jdbc/src/main/java/org/jumpmind/db/platform/mssql/MsSql2008DatabasePlatform.java Diff File

Issue History

Date Modified Username Field Change
2023-06-01 22:16 rwfuller New Issue
2023-06-01 22:16 rwfuller Tag Attached: dialect: sql-server
2023-06-01 22:16 rwfuller Tag Attached: initial/partial load
2023-06-14 17:29 pmarzullo Note Added: 0002340
2023-06-14 17:31 pmarzullo Assigned To => pmarzullo
2023-06-14 17:31 pmarzullo Status new => acknowledged
2023-06-14 17:31 pmarzullo Assigned To pmarzullo => JishLong
2023-07-05 15:00 JishLong Changeset attached => SymmetricDS 3.14 6afa5242
2023-07-05 18:26 JishLong Status acknowledged => resolved
2023-07-05 18:26 JishLong Resolution open => fixed
2023-07-05 18:26 JishLong Fixed in Version => 3.14.8
2023-07-19 12:58 admin Status resolved => closed