taozhi8833998 / node-sql-parser

Parse simple SQL statements into an abstract syntax tree (AST) with the visited tableList and convert it back to SQL
https://taozhi8833998.github.io/node-sql-parser/
Apache License 2.0
818 stars 181 forks source link

Support `IF NOT EXISTS` for creating an index in postgres #2215

Closed 1ilit closed 1 week ago

1ilit commented 1 week ago

Describe the bug It would be great if if not exists was also parsed for creating indices

Database Engine PostgreSQL

To Reproduce -the SQL that be parsed

CREATE UNIQUE INDEX IF NOT EXISTS public_i_locations_pkey ON public.i_locations (id);

-the node-sql-parser version v5.3.4 -the node version v18.20.3

Expected behavior Parse without syntax error