Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[mssql] Support DECLARE statements #151

Open
FreeMasen opened this issue Feb 11, 2020 · 8 comments
Open

[mssql] Support DECLARE statements #151

FreeMasen opened this issue Feb 11, 2020 · 8 comments
Labels
help wanted Extra attention is needed

Comments

@FreeMasen
Copy link

FreeMasen commented Feb 11, 2020

I am running into a few errors trying to parse MsSql.

The following sql

DECLARE @Var1 INTEGER;

reports the following error:

ParserError("Unexpected keyword \"DECLARE\" at the beginning of a statement")

This is a pretty normal thing to appear in t-sql scripts from my experience, though I maybe misunderstanding why this might be an error.

@benesch
Copy link
Contributor

benesch commented Feb 11, 2020

No one has implemented support for that statement is all. PRs welcome!

@nickolay nickolay changed the title Unexpected keyword [mssql] Support DECLARE statements Apr 21, 2020
@nickolay nickolay added the help wanted Extra attention is needed label Apr 21, 2020
@AugustoFKL
Copy link
Contributor

@nickolay @alamb just to make sure, since adding this results in a breaking change on the Statement API. Implementing this is still accepted?

@alamb
Copy link
Contributor

alamb commented Oct 1, 2022

@AugustoFKL -- given that sqlparser uses an enum (that isn't explicitly declared non_exhaustive https://doc.rust-lang.org/reference/attributes/type_system.html) pretty much any change that adds a variant to one of the existing enums will be a breaking change, from a semver perspective.

However, in terms of my take on "easy to upgrade changes" new enum variants to expand the sql support are fine (users have the choice to match _ if they want or they can be explicit)

@alamb
Copy link
Contributor

alamb commented Oct 1, 2022

So "yes adding support for a DECLARE" statement is definitely acceptable from my perspective (like I will review it and help merge it)

@lovasoa
Copy link
Contributor

lovasoa commented Aug 6, 2023

Just adding a comment here because that feature would be very welcome in the SQLPage web application builder: sqlpage/SQLPage#49

@devanbenz
Copy link
Contributor

devanbenz commented Apr 24, 2024

@alamb while working on apache/datafusion#9726 I was running in to this. I often use MSSQL for work so the ScalarVariable syntax that I'm used to is DECLARE @foo AS INT; etc. Could I potentially pick up a PR to modify this library to support that in my endeavor to work on the issue linked? I read through the source code for this lib and see that syntax was still not supported.

@alamb
Copy link
Contributor

alamb commented Apr 27, 2024

Sure -- thank you @devanbenz -- feel free to make a PR and then ping me (or @iffyio ). And thank you!

@devanbenz
Copy link
Contributor

@alamb or @iffyio #1235 please take a look when you can. Also, please let me know if there's anything to improve. I'm a tad bit newer to Rust so always happy to improve via constructive critiques :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

7 participants