This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new b45a8379eb [bugfix](odbc) escape identifiers for sqlserver and 
postgresql (#12487)
b45a8379eb is described below

commit b45a8379ebb1ae05d0302f4e2a26a316617b6054
Author: TengJianPing <18241664+jackte...@users.noreply.github.com>
AuthorDate: Fri Sep 9 09:11:03 2022 +0800

    [bugfix](odbc) escape identifiers for sqlserver and postgresql (#12487)
    
    Delimited identifier format for sqlserver and postgresql is different from 
MySQL.
    Sqlserver use brackets ([ ]) and postgresql use double quotes("").
---
 .../src/main/java/org/apache/doris/catalog/OdbcTable.java    | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/fe/fe-core/src/main/java/org/apache/doris/catalog/OdbcTable.java 
b/fe/fe-core/src/main/java/org/apache/doris/catalog/OdbcTable.java
index 0e283fd2eb..427a8c2e44 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/catalog/OdbcTable.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/catalog/OdbcTable.java
@@ -76,10 +76,22 @@ public class OdbcTable extends Table {
         return "`" + name + "`";
     }
 
+    private static String mssqlProperName(String name) {
+        return "[" + name + "]";
+    }
+
+    private static String psqlProperName(String name) {
+        return "\"" + name + "\"";
+    }
+
     public static String databaseProperName(TOdbcTableType tableType, String 
name) {
         switch (tableType) {
             case MYSQL:
                 return mysqlProperName(name);
+            case SQLSERVER:
+                return mssqlProperName(name);
+            case POSTGRESQL:
+                return psqlProperName(name);
             default:
                 return name;
         }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to