-
Notifications
You must be signed in to change notification settings - Fork 605
Add support for PostgreSQL Insert table aliases (#1069) #1084
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
Pull Request Test Coverage Report for Build 7513619314
💛 - Coveralls |
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 this contribution @boydjohnson - this is looking close.
src/ast/mod.rs
Outdated
let table_name = if let Some(Ident { | ||
value, | ||
quote_style: _, | ||
}) = table_alias | ||
{ | ||
format!("{table_name} AS {value}") |
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 seems like we should format the alias using whatever quote style was originally used
Maybe something like
let table_name = if let Some(Ident { | |
value, | |
quote_style: _, | |
}) = table_alias | |
{ | |
format!("{table_name} AS {value}") | |
let table_name = if let Some(table_alias) = table_alias | |
{ | |
format!("{table_name} AS {table_alias}") |
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.
Thanks, I followed your advice. I rebased and force-pushed. I hope that is ok.
|
||
pg().verified_stmt(sql1); | ||
|
||
let sql2 = "INSERT INTO test_tables AS test_table (id, a) VALUES (DEFAULT, 123)"; |
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.
Could you please:
- Make the
sql2
a second test (e.g.test_simple_postgres_insert_with_alias
) - Add a test for a quoted identifier, something like
INSERT INTO test_tables AS "Test_Table" (id, a) VALUES (DEFAULT, 123)
, perhaps
930ea2f
to
647ddce
Compare
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 @boydjohnson
This is a fix for #1069