supabase-community / postgres_lsp

A Language Server for Postgres
https://supabase.com
MIT License
3.32k stars 62 forks source link

feat: add support for create index #81

Closed cvng closed 10 months ago

cvng commented 11 months ago

What kind of change does this PR introduce?

add support for create index

What is the current behavior?

panics

What is the new behavior?

parser panics for index with using btree (the default) - it works if omitted

parser returns with 5e1ef7b61b38f704b7f4f2af56c441ae9ebcdcfa, but as a side-note Using is always pushed

View log ```rust IndexStmt { idxname: "title_idx", relation: Some( RangeVar { catalogname: "", schemaname: "", relname: "films", inh: true, relpersistence: "p", alias: None, location: 33, }, ), access_method: "btree", table_space: "", index_params: [ Node { node: Some( IndexElem( IndexElem { name: "title", expr: None, indexcolname: "", collation: [], opclass: [], opclassopts: [], ordering: SortbyDefault, nulls_ordering: SortbyNullsDefault, }, ), ), }, ], index_including_params: [], options: [], where_clause: None, exclude_op_names: [], idxcomment: "", index_oid: 0, old_node: 0, old_create_subid: 0, old_first_relfilenode_subid: 0, unique: true, nulls_not_distinct: false, primary: false, isconstraint: false, deferrable: false, initdeferred: false, transformed: false, concurrent: false, if_not_exists: false, reset_default_tblspc: false, } ```

Additional context

NOTE: since access_method is always set, Using is always pushed (even if absent in the original statement)