Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sync-diff-inspector: Doesn't check check constraints #801

Open
dveeden opened this issue May 24, 2024 · 3 comments
Open

sync-diff-inspector: Doesn't check check constraints #801

dveeden opened this issue May 24, 2024 · 3 comments

Comments

@dveeden
Copy link
Contributor

dveeden commented May 24, 2024

Bug Report

Please answer these questions before submitting your issue. Thanks!

  1. What did you do?

Upstream:

create table t3 (id int primary key, check (id<10));

Downstream:

SET GLOBAL tidb_enable_check_constraint=ON;
create table t3 (id int primary key, check (id<20));
  1. What did you expect to see?

Difference in the check constraint being reported

  1. What did you see instead?
Comparing the table structure of ``test`.`t3`` ... equivalent
  1. What version of TiDB are you using (tidb-server -V or run select tidb_version(); on TiDB)?

v8.0.0

  1. which tool are you using?

sync_diff_inspector

  1. what versionof tool are you using (pump -V or tidb-lightning -V or syncer -V)?
$ ./bin/sync_diff_inspector -V
App Name: sync_diff_inspector
Release Version: v8.1.0-1-g17af326
Git Commit Hash: 17af3262fc169d6a4ae3f6ece6ade4e49b24a804
Git Branch: master
UTC Build Time: 2024-05-24 09:30:01
Go Version: go1.22.3
@joechenrh
Copy link

From my perspective of view, check constraints will not affect the comparison results of the table data.
I wonder what scenario require comparison of these constraints.

@dveeden
Copy link
Contributor Author

dveeden commented Dec 3, 2024

@joechenrh this indeed doesn't affect current table data. However it is part of the table structure and one might want to know if the table structure was copied correctly to the target database

@joechenrh
Copy link

@joechenrh this indeed doesn't affect current table data. However it is part of the table structure and one might want to know if the table structure was copied correctly to the target database

The simplest way is to directly check the ExprString in constraints #832

But this method cannot make some complex comparisons, for example, id > 10 and 10 < id.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants