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

Physical table does not keep the constraint of logical table's column #3762

Closed
CookiePieWw opened this issue Apr 20, 2024 · 2 comments
Closed

Comments

@CookiePieWw
Copy link
Collaborator

What type of bug is this?

Incorrect result

What subsystems are affected?

Other

Minimal reproduce step

  1. Create a physical table;
CREATE TABLE `phy`(ts timestamp time index, val double) engine=metric with ("physical_metric_table" = "");
  1. Create a logical table with constraints:
CREATE TABLE t1(ts timestamp time index, val double, host string not null primary key) engine=metric with ("on_physical_table" = "phy");
  1. Show tables:
mysql> desc t1;
+--------+----------------------+------+------+---------+---------------+
| Column | Type                 | Key  | Null | Default | Semantic Type |
+--------+----------------------+------+------+---------+---------------+
| host   | String               | PRI  | NO   |         | TAG           |
| ts     | TimestampMillisecond | PRI  | NO   |         | TIMESTAMP     |
| val    | Float64              |      | YES  |         | FIELD         |
+--------+----------------------+------+------+---------+---------------+
3 rows in set (0.00 sec)

mysql> desc phy;
+------------+----------------------+------+------+---------+---------------+
| Column     | Type                 | Key  | Null | Default | Semantic Type |
+------------+----------------------+------+------+---------+---------------+
| ts         | TimestampMillisecond |      | NO   |         | FIELD         |
| val        | Float64              |      | YES  |         | FIELD         |
| __table_id | UInt32               | PRI  | NO   |         | TAG           |
| __tsid     | UInt64               | PRI  | NO   |         | TAG           |
| host       | String               | PRI  | YES  |         | TAG           |
+------------+----------------------+------+------+---------+---------------+
5 rows in set (0.00 sec)

What did you expect to see?

The physical table's host column also has the not null constraint.

What did you see instead?

It does not.

What operating system did you use?

doesn't matter

What version of GreptimeDB did you use?

0.7.2

Relevant log output and stack trace

No response

@WenyXu
Copy link
Member

WenyXu commented Apr 20, 2024

It seems it's by design. The engine will ignore the constraint on the logical table columns. @waynexia

@WenyXu
Copy link
Member

WenyXu commented Apr 26, 2024

Track in #3780

@WenyXu WenyXu closed this as completed Apr 26, 2024
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