-
Notifications
You must be signed in to change notification settings - Fork 653
Added support for MATCH syntax and unified column option ForeignKey #2062
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
base: main
Are you sure you want to change the base?
Added support for MATCH syntax and unified column option ForeignKey #2062
Conversation
if self.parse_keyword(Keyword::CONSTRAINT) { | ||
let name = Some(self.parse_identifier()?); | ||
if let Some(option) = self.parse_optional_column_option()? { | ||
if let Some(option) = self.parse_optional_column_option(&col_name)? { |
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.
not sure what this change implies, it looks like we'd be storing the column name twice in the AST node which doesn't seem ideal?
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 is needed to standardize ForeignKeyConstraint
and avoid having a duplicated struct to represent the same type of concept. I could possibly leave the columns
vector of the ForeignKeyConstraint
empty, but when I use that struct in code that works on top of the AST it is quite useful to have the column ident defined there, and not have to handle the case of a special ForeignKeyConstraint
.
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.
You will note that it is the same change needed for PR #2064, which I did separately but the goal is identical - to standardize the structs used to represent constraints in the columns and table.
Co-authored-by: Ifeanyi Ubah <[email protected]>
Co-authored-by: Ifeanyi Ubah <[email protected]>
Co-authored-by: Ifeanyi Ubah <[email protected]>
Co-authored-by: Ifeanyi Ubah <[email protected]>
Co-authored-by: Ifeanyi Ubah <[email protected]>
Co-authored-by: Ifeanyi Ubah <[email protected]>
Co-authored-by: Ifeanyi Ubah <[email protected]>
Co-authored-by: Ifeanyi Ubah <[email protected]>
Co-authored-by: Ifeanyi Ubah <[email protected]>
Co-authored-by: Ifeanyi Ubah <[email protected]>
This PR adds support for the SQL standard
MATCH [FULL | PARTIAL | SIMPLE]
syntax for foreign key constraints.Changes
PARTIAL
andSIMPLE
MatchKind
enum withFull
,Partial
, andSimple
variantsMATCH
syntax in both column-level and table-level foreign key constraintsColumnOption::ForeignKey
to useForeignKeyConstraint
struct, eliminating code duplicationExamples
Closes issue #2061 and works towards closing issue #2059