keeps/dbptk-developer

SIARD Validation gets confused when two tables in different schemas have the same name.

stighemmer opened this issue · 1 comments

Description:
When multiple schemas exist, and two tables in different schema have the same name, the primary/candidate key part of SIARD validation gets confused and gives errors.

This example SIARD file is produced by dbptk itself.

Steps required to reproduce the bug:

  1. Rename the attached testdb.zip to testdb.siard.
    testdb.zip

  2. Validate it.

  3. Read report.
    dbptk-validation-reporter-testdb-20240524221110141.txt
    Highlights:

A_M_5.8-1-2: [ERROR] : Primary key column reference id not found on dbo.testtable
A_M_5.11-1-2: [ERROR] : Candidate key column reference id not found on dbo.testtable

  1. Notice that dbo.testtable does in fact have a column id.
  2. But other.testtable do not.

Attach the dbptk-app.log.txt file below.
dbptk-app.log.txt
This log describes both the creation of the SIARD file and the validation of it.

In my eagerness to create a minimal example, I removed too much. There is also a problem with foreign keys.

New test file:
testdb-fk.zip

New report, new highlights:
dbptk-validation-reporter-testdb-20240528211236978.txt

A_M_5.8-1-2: [ERROR] : Primary key column reference id not found on dbo.testtable
A_M_5.10-1-1: [ERROR] : referenced column name fkother does not exist on referenced table testtable
M_5.10-1-2: [ERROR] : Unable to validate, column does not exist (metadata.xml schema:dbo/table:testtable/foreignKey:FK_dbo_other/reference:fkother)
A_M_5.10-1-2: [ERROR] : Unable to validate, column does not exist (metadata.xml schema:dbo/table:testtable/foreignKey:FK_dbo_other/reference:fkother)
A_M_5.10-1-2: [ERROR] : referenced column name id of table testtable does not exist on referenced table testtable
A_M_5.11-1-2: [ERROR] : Candidate key column reference id not found on dbo.testtable

New app.log:
dbptk-app.log.txt