Overview of the Issue
If you have a sequence definition like:
CREATE TABLE t1_seq (
id bigint unsigned NOT NULL,
next_id bigint unsigned,
cache bigint unsigned,
PRIMARY KEY (id)
) COMMENT 'vitess_sequence';
and the associated vschema to use it, when you try and plan an INSERT query using the sequence via vtexplain, you will get an error like:
target: unsharded.-.primary: t1_seq is not a sequence
Scratched my head about this for a bit, but if you look at the code for checking the sequence comment, the problem becomes clearer:
https://github.com/vitessio/vitess/blob/release-18.0/go/vt/vtexplain/vtexplain_vttablet.go#L426
We check for comment (lowercase); and the option.Name values are not normalized. The problem is therefore the capitalization. Using the following sequence definition therefore works:
CREATE TABLE t1_seq (
id bigint unsigned NOT NULL,
next_id bigint unsigned,
cache bigint unsigned,
PRIMARY KEY (id)
) comment 'vitess_sequence';
Reproduction Steps
See above.
Binary Version
release-18.0 main branch; but this affects all Vitess versions since the support was merged from https://github.com/vitessio/vitess/pull/7186
Operating System and Environment details
Log Fragments
No response
Overview of the Issue
If you have a sequence definition like:
and the associated vschema to use it, when you try and plan an INSERT query using the sequence via vtexplain, you will get an error like:
Scratched my head about this for a bit, but if you look at the code for checking the sequence comment, the problem becomes clearer:
https://github.com/vitessio/vitess/blob/release-18.0/go/vt/vtexplain/vtexplain_vttablet.go#L426
We check for
comment(lowercase); and theoption.Namevalues are not normalized. The problem is therefore the capitalization. Using the following sequence definition therefore works:Reproduction Steps
See above.
Binary Version
release-18.0 main branch; but this affects all Vitess versions since the support was merged from https://github.com/vitessio/vitess/pull/7186Operating System and Environment details
Log Fragments
No response