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

Validation needs to be added while creating the logical table #3760

Closed
WenyXu opened this issue Apr 20, 2024 · 0 comments · Fixed by #3772
Closed

Validation needs to be added while creating the logical table #3760

WenyXu opened this issue Apr 20, 2024 · 0 comments · Fixed by #3772
Assignees
Labels
C-bug Category Bugs

Comments

@WenyXu
Copy link
Member

WenyXu commented Apr 20, 2024

          > > Sorry, I missed something. Could you provide an example to explain the difference?

As for the physical table, here I add some constraints for val:

CREATE TABLE phy (ts timestamp time index, val double not null default 0) engine=metric with ("physical_metric_table" = ""); 

Currently we can create a logical table with the val column but without constraints (or add more constraints), and also change the data type of it:

CREATE TABLE phy (ts timestamp time index, val int, host string, primary key (host)) engine=metric with ("on_physical_table" = "phy"); 

I wonder if its appropriate to create sql like this for fuzz test.

I got you. It's a bug; it will throw an error if users try to insert values into a logical table. Some validation needs to be added while creating the logical table(It will be tracked in another issue).

Reproduce steps:

  1. Create tables
CREATE TABLE `phy`(ts timestamp time index, val double) engine=metric with ("physical_metric_table" = "");

CREATE TABLE t1 (ts timestamp time index, val int, host string, primary key (host)) engine=metric with ("on_physical_table" = "phy");

CREATE TABLE t2 (ts timestamp time index, val string, host string, primary key (host)) engine=metric with ("on_physical_table" = "phy");
  1. Insert values
mysql> insert t2 (host,ts,val) values ("hi",1702433146000,"10");
ERROR 1815 (HY000): Invalid request to region 4398046511104(1024, 0), reason: column val expect type Float64(Float64Type), given: STRING(12)

mysql> insert t1 (host,ts,val) values ("hi",1702433146000,1);
ERROR 1815 (HY000): Invalid request to region 4398046511104(1024, 0), reason: column val expect type Float64(Float64Type), given: INT32(3)

Originally posted by @WenyXu in #3741 (comment)

@WenyXu WenyXu added the C-bug Category Bugs label Apr 20, 2024
@waynexia waynexia self-assigned this Apr 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category Bugs
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants