-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Verify column name length in PostgreSQL and SQL Server #13742
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
Changes from all commits
7f4a08a
6381cff
23b483c
b01e763
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -150,6 +150,9 @@ public class MariaDbClient | |
| // An empty character means that the table doesn't have a comment in MariaDB | ||
| private static final String NO_COMMENT = ""; | ||
|
|
||
| // MariaDB Error Codes https://mariadb.com/kb/en/mariadb-error-codes/ | ||
| private static final int PARSE_ERROR = 1064; | ||
|
||
|
|
||
| private final AggregateFunctionRewriter<JdbcExpression, String> aggregateFunctionRewriter; | ||
|
|
||
| @Inject | ||
|
|
@@ -457,7 +460,8 @@ public void renameColumn(ConnectorSession session, JdbcTableHandle handle, JdbcC | |
| execute(connection, sql); | ||
| } | ||
| catch (TrinoException e) { | ||
| if (e.getCause() instanceof SQLSyntaxErrorException) { | ||
| // Note: SQLSyntaxErrorException can be thrown also when column name is invalid | ||
| if (e.getCause() instanceof SQLSyntaxErrorException syntaxError && syntaxError.getErrorCode() == PARSE_ERROR) { | ||
|
||
| throw new TrinoException(NOT_SUPPORTED, "Rename column not supported for the MariaDB server version", e); | ||
| } | ||
| throw e; | ||
|
|
||
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.
Why aren't these quoted?
(i know they weren't quoted before the refactor)
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 for catching that. Let me fix in a follow-up PR.