yuqi1129 opened a new issue, #14762:
URL: https://github.com/apache/gravitino/issues/14762

   ### Version
   
   main branch
   
   ### Describe what's wrong
   
   MySQL, Doris and StarRocks DDL wraps identifiers in backticks without 
doubling embedded backticks (for example ``"`" + name + "`"`` and ``DROP TABLE 
`%s` ``), and Doris/StarRocks partition statements do the same for table and 
partition names. A table, column or partition that already exists in the 
database with a backtick in its name produces malformed SQL, and the name can 
end the identifier early.
   
   Separately, in `CapabilityHelpers`:
   - the `AFTER` sibling of a top-level `AddColumn` is passed through without 
existing-name validation or case normalization, unlike the `AFTER` sibling of 
`UpdateColumnPosition`;
   - the first component of a nested `AddColumn` is validated as a new column 
name although it names an existing parent column;
   - nested `AFTER` siblings are validated and normalized as if they were 
top-level column names.
   
   ### Error message and/or stacktrace
   
   The database rejects the generated statement with a syntax error, or 
executes a statement different from the intended one.
   
   ### How to reproduce
   
   1. Create a MySQL table natively whose name contains a backtick, for example 
``a`b; --``.
   2. Drop or alter it through Gravitino.
   3. The generated SQL is malformed because the embedded backtick is not 
escaped.
   
   ### Additional context
   
   Existing native names should be quoted safely by every operation that 
references them, while new names keep their creation rules.
   


-- 
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]

Reply via email to