Turbo87 opened a new issue, #2132:
URL: https://github.com/apache/datafusion-sqlparser-rs/issues/2132
The parser fails to parse the PostgreSQL-specific `PRIMARY KEY USING INDEX
index_name` syntax in `ALTER TABLE` statements:
```sql
ALTER TABLE version_downloads
ADD CONSTRAINT version_downloads_pkey PRIMARY KEY USING INDEX
version_downloads_unique;
```
```
Expected: a list of columns in parentheses, found: INDEX
```
## Expected behavior
This is valid PostgreSQL syntax per the [ALTER TABLE
documentation](https://www.postgresql.org/docs/current/sql-altertable.html).
The grammar allows:
```
ADD table_constraint_using_index
```
Where `table_constraint_using_index` can be:
```
[ CONSTRAINT constraint_name ]
{ UNIQUE | PRIMARY KEY } USING INDEX index_name
[ DEFERRABLE | NOT DEFERRABLE ] [ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
```
Note that `PRIMARY KEY USING INDEX index_name` is a distinct form that does
**not** require a column list - it promotes an existing unique index to be the
primary key constraint.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]