Hello experts, I want to add a GLOBAL keyword to create an index, but GLOBAL cannot directly follow CREATE

Note:
This topic has been translated from a Chinese forum by GPT and might contain errors.

Original topic: 大佬们好,我想给建索引添加一个GLOBAL关键字,但GLOBAL不能直接跟在CREATE后面

| username: TiDBer_KUR3fjyg

Hello everyone, I want to add a GLOBAL keyword when creating an index, but GLOBAL cannot directly follow CREATE. It can follow other keywords, for example, CREATE UNIQUE GLOBAL works, but CREATE GLOBAL INDEX does not.

| username: forever | Original post link

I didn’t see this syntax in the documentation.

| username: TiDBer_KUR3fjyg | Original post link

Yes, I know. I just want to add this syntax in the code.

| username: 小龙虾爱大龙虾 | Original post link

Look :neutral_face:, if the syntax is changed, does the implementation also need to be changed?

| username: TiDBer_KUR3fjyg | Original post link

Looking at the code, it’s just these few places.

| username: Kongdom | Original post link

:thinking: I don’t understand, what is the purpose of adding this?

| username: h5n1 | Original post link

Waiting for the global index for partitioned tables to be released in version 8.1.

| username: TiDBer_KUR3fjyg | Original post link

Well, using the goInception audit tool, which is based on TiDB, so I’m here to ask, does the PolarDB database have the CREATE GLOBAL INDEX syntax?

| username: 春风十里 | Original post link

This means creating a global index for partitioned tables, right? It seems it hasn’t been released yet.

| username: TIDB-Learner | Original post link

CREATE GLOBAL INDEX global secondary index, this is probably not supported by TiDB yet.

| username: Kongdom | Original post link

:joy: Oh, a global index for partitioned tables. I misunderstood earlier and thought it was some special syntax.

| username: TiDBer_KUR3fjyg | Original post link

Yes, are you familiar with the parser.y file?

| username: 有猫万事足 | Original post link

This goInception contains modification records that support OB syntax. You can refer to this and make changes; it’s much more reliable than modifying TiDB’s parser.

It seems that the subsequent syntax support for different databases in goInception actually uses a parser version that is unrelated to TiDB and is no longer synchronized.

Since OB can be supported, I think you might as well raise an issue in this project, hoping to support PolarDB. It’s not impossible.

| username: 烂番薯0 | Original post link

I haven’t seen the documentation…

| username: Kongdom | Original post link

:joy: Not familiar, you can try following the suggestion from the expert above.

| username: TiDBer_KUR3fjyg | Original post link

It seems that the syntax support for different databases in goInception is actually using a parser version that is not related to TiDB and is no longer synchronized.

The support for OB should be handled by the OB product team. PolarDB might not work, but the CREATE GLOBAL INDEX syntax issue has been resolved.

| username: 有猫万事足 | Original post link

Awesome :+1:
I checked and it really is someone from OB.

This is getting interesting. They actually don’t use OB’s own SQL parser. :rofl:

| username: TiDBer_KUR3fjyg | Original post link

OB is written in C++, but the goInception tool uses TiDB, and TiDB is written in Go.

| username: 有猫万事足 | Original post link

The first generation of Inception was made in C. goInception is already the second generation. This can only be said that the open-source process was slow, and the community ecosystem was established late.

| username: TiDBer_KUR3fjyg | Original post link

Inception has become closed-source, which is why goInception was created.