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

Support snowflake double dot notation for object name #1540

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ayman-sigma
Copy link

Snowflake allows double-dot notation in the object name. The two dots indicate that the schema name is not specified. The PUBLIC default schema is always referenced. See more details here: https://docs.snowflake.com/en/sql-reference/name-resolution#resolution-when-schema-omitted-double-dot-notation

Right now I'm parsing the default schema segment as an empty identifier. Depending on the acceptance of this PR, we can change this to be something like DefaultSchema instead.

@@ -8349,6 +8349,13 @@ impl<'a> Parser<'a> {
pub fn parse_object_name(&mut self, in_table_clause: bool) -> Result<ObjectName, ParserError> {
let mut idents = vec![];
loop {
if self.dialect.supports_object_name_double_dot_notation()
&& !idents.is_empty()
Copy link
Author

Choose a reason for hiding this comment

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

I'm debating if I should force it only for missing schema. Which means only accepts x..y and rejects stuff like x.y..z. Forcing this seems like a semantic validation that we are trying to avoid.

Copy link
Author

Choose a reason for hiding this comment

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

There was a test case that specifically test the invalid object name of x.y..z. So I updated it to support only missing schema in x..y.

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

Successfully merging this pull request may close these issues.

1 participant