diff --git a/server/odc-migrate/src/main/resources/migrate/common/R_2_0_0__initialize_version_diff_config.sql b/server/odc-migrate/src/main/resources/migrate/common/R_2_0_0__initialize_version_diff_config.sql index 04c7dbb484..7c4caaf92d 100644 --- a/server/odc-migrate/src/main/resources/migrate/common/R_2_0_0__initialize_version_diff_config.sql +++ b/server/odc-migrate/src/main/resources/migrate/common/R_2_0_0__initialize_version_diff_config.sql @@ -275,4 +275,15 @@ insert into `odc_version_diff_config`(`config_key`,`db_mode`,`config_value`,`min 'bit:NUMERIC, tinyint:NUMERIC, smallint:NUMERIC, int:NUMERIC, bigint:NUMERIC, decimal:NUMERIC, numeric:NUMERIC, float:NUMERIC, real:NUMERIC, money:NUMERIC, smallmoney:NUMERIC, char:TEXT, varchar:TEXT, nchar:TEXT, nvarchar:TEXT, text:OBJECT, ntext:OBJECT, binary:TEXT, varbinary:TEXT, image:OBJECT, date:DATE, time:TIME, datetime:DATETIME, datetime2:DATETIME, smalldatetime:DATETIME, datetimeoffset:TIMESTAMP, timestamp:OBJECT, uniqueidentifier:OBJECT, xml:OBJECT, sql_variant:OBJECT, hierarchyid:OBJECT, geography:OBJECT, geometry:OBJECT', '0', CURRENT_TIMESTAMP) ON DUPLICATE KEY update `config_key`=`config_key`; insert into `odc_version_diff_config`(`config_key`,`db_mode`,`config_value`,`min_version`,`gmt_create`) values('support_view','SQL_SERVER','true','0',CURRENT_TIMESTAMP) ON DUPLICATE KEY update `config_key`=`config_key`; insert into `odc_version_diff_config`(`config_key`,`db_mode`,`config_value`,`min_version`,`gmt_create`) values('support_procedure','SQL_SERVER','true','0',CURRENT_TIMESTAMP) ON DUPLICATE KEY update `config_key`=`config_key`; -insert into `odc_version_diff_config`(`config_key`,`db_mode`,`config_value`,`min_version`,`gmt_create`) values('support_function','SQL_SERVER','true','0',CURRENT_TIMESTAMP) ON DUPLICATE KEY update `config_key`=`config_key`; \ No newline at end of file +insert into `odc_version_diff_config`(`config_key`,`db_mode`,`config_value`,`min_version`,`gmt_create`) values('support_function','SQL_SERVER','true','0',CURRENT_TIMESTAMP) ON DUPLICATE KEY update `config_key`=`config_key`; + +-- GaussDB / openGauss column data types (PostgreSQL-compatible) +-- Required so VersionDiffConfigService.getDatatypeList() returns a non-empty list for GAUSSDB sessions. +-- Without this row, session.dataTypes is empty and the column editor's data type dropdown shows no options. +insert into `odc_version_diff_config`(`config_key`,`db_mode`,`config_value`,`min_version`,`gmt_create`) values( + 'column_data_type', + 'GAUSSDB', + 'smallint:NUMERIC, integer:NUMERIC, int:NUMERIC, bigint:NUMERIC, decimal:NUMERIC, numeric:NUMERIC, real:NUMERIC, float:NUMERIC, serial:NUMERIC, bigserial:NUMERIC, char:TEXT, varchar:TEXT, text:OBJECT, bytea:OBJECT, boolean:NUMERIC, date:DATE, time:TIME, timestamp:TIMESTAMP, timestamptz:TIMESTAMP, interval:TEXT, json:OBJECT, jsonb:OBJECT, uuid:OBJECT', + '1.0', + CURRENT_TIMESTAMP +) ON DUPLICATE KEY UPDATE `config_key`=`config_key`; \ No newline at end of file diff --git a/server/odc-service/src/main/java/com/oceanbase/odc/service/session/ConnectConsoleService.java b/server/odc-service/src/main/java/com/oceanbase/odc/service/session/ConnectConsoleService.java index 725259ceea..d740fc8df4 100644 --- a/server/odc-service/src/main/java/com/oceanbase/odc/service/session/ConnectConsoleService.java +++ b/server/odc-service/src/main/java/com/oceanbase/odc/service/session/ConnectConsoleService.java @@ -184,6 +184,18 @@ public SqlExecuteResult queryTableOrViewData(@NotNull String sessionId, asyncExecuteReq.setContinueExecutionOnError(true); asyncExecuteReq.setFullLinkTraceEnabled(false); return executeQueryTableOrViewData(sessionId, connectionSession, asyncExecuteReq); + } else if (dialectType.isPgFamily()) { + // GaussDB / openGauss / PostgreSQL use PostgreSQL wire protocol, where identifiers + // are quoted with double quotes (e.g. "schema"."table"), NOT MySQL back-ticks. + // Reusing MySQLSqlBuilder here previously produced + // SELECT t.* FROM `schema`.`table` t LIMIT 1000 + // which triggered SQLState=42601 syntax error at or near "`" against openGauss. + // OracleSqlBuilder.identifier() wraps identifiers with '"' (see + // StringUtils.ORACLE_IDENTIFIER_WRAP_CHAR), which is exactly what PG expects. + // Only identifier() / schemaPrefixIfNotBlank() are exercised below, so the rest of + // OracleSqlBuilder's Oracle-specific behavior (value quoting, default values, + // LIKE ESCAPE) is never invoked here and is therefore safe to reuse. + sqlBuilder = new OracleSqlBuilder(); } else { throw new IllegalArgumentException("Unsupported dialect type, " + dialectType); }