xitep opened a new pull request, #2103:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2103

   Right now `sqlparser-rs` injects the `AS` keyword in front of alias names 
unconditionally. As reported by #1875 or #1784 this leads to problems on Oracle 
databases.  This patch preserves the original absence / presence  of the 
keyword (implicit/explicit aliases) in "table-factor" position when rendered 
via `Display`.
   
   1. Some more effort could be invested to apply the same behavior for 
select-items (ie. projections in queries) and/or further nodes of the AST with 
an alias for which `AS` is optional.  To unify the implementation within the 
parser and for clients, representing aliases could be exposed not as pure 
`Ident`s but maybe as something as:
   
   ```rust
   struct Alias {
     explicit: bool,
     name: Ident,
   }
   
   impl Deref for Alias {
     type Target = Ident;
     ...
   }
   
   impl From<Alias> for Ident {
     ...
   }
   ```
   
   2. The parser _could_ be instructed / configured (either by `ParserOptions` 
or through a `Dialect` setting) to always produce "explicit" alias tokens. This 
would then always produce the "AS" keyword when render via `Display`. Ideally, 
there would be a `VisitorMut::visit_(mut_)alias` and clients could just apply 
their own setting easily. But this would be rather a nice-to-have.
   
   3. I'd greatly appreciate a critical look since my know-how regarding 
different DBs is quite limited. I hope I've not broken any of the existing 
dialects and also hope this PR helps "preserving the syntax round trip".
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to