google / google/googlesql

Spanner Dialect - ALTER INDEX Unexpected Error

Open
#147 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
2.6k
Forks
260
PR merge metrics
No merged PRs in 30d

Description

Hello,
According to documentation, the ALTER INDEX statement should follow this example:
```
ALTER INDEX index_name {ADD|DROP} STORED COLUMN column_name
```
Reference: https://cloud.google.com/spanner/docs/secondary-indexes#googlesql_5

That said, while trying out the parser in the following piece of code
```
String query = ;
LanguageOptions languageOptions = new LanguageOptions();
ASTNodes.ASTScript parsedScript = Parser.parseScript(query, languageOptions);
```

I found that:

- When `query` was:
```
ALTER INDEX i1 DROP STORED COLUMN author;
```

The Parser returns: `Unexpected keyword STORED [at 1:21]`

- When `query` was:
```
ALTER INDEX i1 DROP COLUMN author;
```

The Parser returns: `ALTER INDEX is not supported [at 1:7]`

- When `query` was:
```
ALTER INDEX i1 ADD COLUMN author;
```

The Parser returns: `Unexpected ";" [at 1:33]`

- When `query` was:
```
ALTER INDEX i1 ADD STORED COLUMN author;
```

The Parser returns: `Unexpected keyword STORED [at 1:20]`

I was wondering if this was the expected result and if `ALTER INDEX` will be supported in the future.
Thanks

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.