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
755 stars 172 forks source link

DROP VIEW not supported in build/sqlite #1927

Closed carloslfu closed 1 month ago

carloslfu commented 1 month ago

DROP VIEW statement is not supported by SQLite build. Here is an example:

DROP VIEW IF EXISTS view_name;

The error that appears is:

[SyntaxError]: Expected "#", "--", "/*", ":=", "=", "INDEX", "TABLE", or [ \t\n\r] but "V" found.
    at peg$buildStructuredError (/Users/taozhi/Workspaces/OpenSources/node-sql-parser/pegjs/sqlite.pegjs:2548:12)
    at typeCase (/Users/taozhi/Workspaces/OpenSources/node-sql-parser/pegjs/sqlite.pegjs:24598:11)

I'd like to help with this one as it looks very similar to #1694 and I could use what you did to solve it via #1695 @taozhi8833998. This seems like a good start for me since I'll be using this library a lot and would like to contribute to it. WDYT?

taozhi8833998 commented 1 month ago

@carloslfu Thank you for participating. I will release an update today, so I resolved it by myself. Please review the PR codes to ensure alignment with your intended codes.

carloslfu commented 1 month ago

This is great! Thank you! I just checked it. It looks good!