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
Support parsing MySQL's USING [ BTREE | HASH ] index type syntax everywhere where it is supported #9132
Comments
I think we should focus on implementing your parser heuristics idea (#9084). We should collect a set of syntaxes that these heuristics should parse, and we can ignore them. That might scale a bit better in the future, than creating an issue on GitHub per syntax. |
Yes, I also like that idea. I will look into it. |
Related #9217 |
I don't fully trust those heuristics yet, as discussed in that other issue. Meanwhile, supporting this relatively common clause in the parser seems not too difficult. I'll take this and implement it "classically". In fact, we might want to support index types natively (see #9230) and translate them between dialects, in case of which this particular syntax needs to be parsed explicitly anyway. |
Heh, there's some additional fun caveat in the syntax:
Where
So, this clause can be placed before or after the column list... :-) |
Even this parses o_O create table t (i int, index using btree (i) using hash); |
And then, we can also use the syntax with constraints (which automatically create indexes, too) |
It is, however, not possible with foreign key constraints |
Notice, in issue #9120, the syntax exposing the problem was an |
It is not possible to specify these clauses on inline constraint definitions, such as: create table t (i int primary key using btree); |
These both work: create table t (i int, primary key using btree (i));
create table t (i int, primary key (i) using btree); |
Of course, this whole duality of supporting that index type before or after the column spec also exists in create index i using btree on t (a);
create index i on t (a) using btree; |
…tax everywhere where it is supported
As MySQL's
CREATE TABLE
allows for inline index creation, the statement also has theUSING [ BTREE | HASH ]
clause.In MySQL BTREE is also the default for most storage engines, but for some it is also HASH.
Note that
CREATE INDEX ... USING BTREE
was already implemented in #7749.The text was updated successfully, but these errors were encountered: