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

Add support for AS table_alias syntax for inserts in Postgres #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

CDThomas
Copy link

Adds support for using table aliases in inserts.

@CDThomas
Copy link
Author

Could use some more tests and possibly some refactoring, but this should do it.

@@ -7105,6 +7105,15 @@ impl<'a> Parser<'a> {
// Hive lets you put table here regardless
let table = self.parse_keyword(Keyword::TABLE);
let table_name = self.parse_object_name()?;

let is_postgresql = dialect_of!(self is PostgreSqlDialect);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to the docs, dialect specific syntax needs to be handled for both the dialect in question and the GenericDialect.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that only applies when you need to make changes to the dialect itself. I don't think that matters here, but I'll see what the maintainer says when I raise it upstream.

I still need to check other dialects as well to verify that this needs to be dialect specific.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this doing exactly that? Changing the dialect?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants