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
support DROP FUNCTION
syntax
#752
Conversation
Pull Request Test Coverage Report for Build 3764235521
💛 - Coveralls |
src/ast/mod.rs
Outdated
if_exists: bool, | ||
/// One or more function to drop | ||
func_desc: Vec<DropFunctionDesc>, | ||
cascade: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zidaye maybe an enum here would be better (or an option with a boolean inside).
Here you allow the state "cascade + restrict", which doesn't make sense at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@AugustoFKL done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for the contribution @zidaye
I have some suggestions, but overall this PR is looking close
src/ast/mod.rs
Outdated
/// One or more function to drop | ||
func_desc: Vec<DropFunctionDesc>, | ||
/// `CASCADE` or `RESTRICT` | ||
option: Option<DropFunctionOption>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will change it later, thanks for your suggestion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be possible to use https://github.com/sqlparser-rs/sqlparser-rs/blob/d420001c37eeb38aac26a85dd5661755d6ef4228/src/ast/ddl.rs#LL602C16-L602C16
done
DropFunction { | ||
if_exists: bool, | ||
/// One or more function to drop | ||
func_desc: Vec<DropFunctionDesc>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about reusing the CreateFunctionArg
structure used in CREATE FUNCTION
Lines 1410 to 1417 in d420001
CreateFunction { | |
or_replace: bool, | |
temporary: bool, | |
name: ObjectName, | |
args: Option<Vec<CreateFunctionArg>>, | |
return_type: Option<DataType>, | |
/// Optional parameters. | |
params: CreateFunctionBody, |
?
I can also see the argument for using a separate struct. If we stay with a separate struct, I suggest we name if DropFunctionArg
to mirror the CreateFunctionArg
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll try to combine these structures later
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about reusing the
CreateFunctionArg
structure used in CREATE FUNCTIONLines 1410 to 1417 in d420001
CreateFunction { or_replace: bool, temporary: bool, name: ObjectName, args: Option<Vec<CreateFunctionArg>>, return_type: Option<DataType>, /// Optional parameters. params: CreateFunctionBody, ?
I can also see the argument for using a separate struct. If we stay with a separate struct, I suggest we name if
DropFunctionArg
to mirror theCreateFunctionArg
sorry for my late reply。I've reconsidered your suggestion, and I think the structure might be acceptable. The DropFunctionDesc
contains the function name and function parameters. The CreateFunctionArg
only describes function parameters. Also, CreateFunctionArg
has been reused and renamed OperateFunctionArg
marking as draft -- please mark as ready for review when you have made the changes you plan. Thank you |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @zidaye
close #753
refer to :https://www.postgresql.org/docs/current/sql-dropfunction.html