25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。
TypeScript aicliclickhousedatabasedatabase-clientdatabase-managementdockerguimcpmongodbmysqlpostgresqlredisrustsql-serversqlitetaurivue
fix(greenplum): skip the row locator for greenplum-lineage servers
弈秋f6a4d69e69fa
diff --git a/apps/desktop/src/composables/useDataGridLargeValues.ts b/apps/desktop/src/composables/useDataGridLargeValues.tsindex 1f80924ddd..ceeed18c71 100644--- a/apps/desktop/src/composables/useDataGridLargeValues.ts+++ b/apps/desktop/src/composables/useDataGridLargeValues.ts@@ -4,6 +4,7 @@ import type { CellValue } from "@/lib/dataGrid/cellValue";import { buildDataGridContextFilterCondition } from "@/lib/dataGrid/dataGridSql";import { buildTableSelectSql } from "@/lib/table/tableSelectSql";import { shouldIncludeSyntheticRowId } from "@/lib/table/tableEditing";+import { rowIdLocatorUnsupported } from "@/lib/table/tableRowIdSupport";import { queryTimeoutSecsForConnection } from "@/lib/sql/queryTimeout";import { materializeLargeValueSnapshot, waitForLargeValueSnapshot } from "@/lib/dataGrid/largeValueSnapshot";import type { ColumnInfo, ConnectionConfig, DatabaseType, QueryResult } from "@/types/database";@@ -349,7 +350,7 @@ export function useDataGridLargeValues(options: UseDataGridLargeValuesOptions) {whereInput: predicates.map((predicate) => `(${predicate})`).join(" OR "),limit: requests.size,offset: 0,- includeRowId: shouldIncludeSyntheticRowId(options.databaseType.value, tableMeta.primaryKeys, tableMeta.tableType),+ includeRowId: shouldIncludeSyntheticRowId(options.databaseType.value, tableMeta.primaryKeys, tableMeta.tableType) && !(options.connectionId.value ? rowIdLocatorUnsupported(options.connectionId.value) : false),});if (!visibleLargeValuePreviewActive || generation !== visibleLargeValuePreviewRequestedGeneration || options.result.value !== sourceResult) return;const connection = options.getConnectionConfig(options.connectionId.value!);@@ -521,7 +522,7 @@ export function useDataGridLargeValues(options: UseDataGridLargeValuesOptions) {whereInput: predicates.map((predicate) => `(${predicate})`).join(" OR "),limit: requests.length,offset: 0,- includeRowId: shouldIncludeSyntheticRowId(options.databaseType.value, tableMeta.primaryKeys, tableMeta.tableType),+ includeRowId: shouldIncludeSyntheticRowId(options.databaseType.value, tableMeta.primaryKeys, tableMeta.tableType) && !(options.connectionId.value ? rowIdLocatorUnsupported(options.connectionId.value) : false),});const connection = options.connectionId.value ? options.getConnectionConfig(options.connectionId.value!) : undefined;const results = await api.executeMulti(options.connectionId.value!, options.executionDatabase.value, sql, undefined, options.uuid(), {diff --git a/crates/dbx-sql-dialect/src/sql_dialect/table_select.rs b/crates/dbx-sql-dialect/src/sql_dialect/table_select.rsindex bdff91cbc9..d808d4c0bf 100644--- a/crates/dbx-sql-dialect/src/sql_dialect/table_select.rs+++ b/crates/dbx-sql-dialect/src/sql_dialect/table_select.rs@@ -379,7 +379,13 @@ pub fn build_table_data_select_sql_with_database(let include_postgres_ctid = options.include_row_id&& uses_postgres_ctid(database_type)&& is_postgres_base_table_type(options.table_type.as_deref())- && options.primary_keys.is_empty();+ && options.primary_keys.is_empty()+ // Greenplum connects as plain PostgreSQL and reports itself through+ // version(); its segments reject system-column references like+ // `tableoid`/`ctid`/`xmin` with "cannot retrieve a system column in+ // this context" (#13227). Cloudberry's version also carries the+ // Greenplum lineage, so one substring covers both.+ && !is_greenplum_server(options.server_version.as_deref());let offset = options.offset.unwrap_or(0);// Oracle previews ride the ROWNUM inline view: the truncated projections// and marker columns live in the inner SELECT, and the outer page SELECT@@ -1022,6 +1028,17 @@ pub(super) fn build_db2_table_select_page_sql()}+/// Whether a plain-PostgreSQL connection's reported server version identifies+/// a Greenplum-lineage engine whose segments cannot retrieve system columns.+/// Covers both Greenplum and its Cloudberry fork, whose `version()` reports+/// `PostgreSQL 14.4 (Cloudberry Database ...)` without the "greenplum" word.+fn is_greenplum_server(server_version: Option<&str>) -> bool {+ server_version.is_some_and(|version| {+ let version = version.to_ascii_lowercase();+ version.contains("greenplum") || version.contains("cloudberry")+ })+}+/// Neo4j 5.0 replaced `id()` with `elementId()`, and servers before that only know `id()`, so the/// generated Cypher has to pick the spelling the connected server accepts. An unknown version keeps/// `elementId()`, which is what every caller without connection metadata got before.diff --git a/crates/dbx-sql-dialect/src/sql_dialect/tests.rs b/crates/dbx-sql-dialect/src/sql_dialect/tests.rsindex 341fd599c1..91f006c6f2 100644--- a/crates/dbx-sql-dialect/src/sql_dialect/tests.rs+++ b/crates/dbx-sql-dialect/src/sql_dialect/tests.rs@@ -1456,6 +1456,43 @@ fn explicit_table_data_order_is_preserved() {);}+#[test]+fn greenplum_servers_do_not_receive_the_system_column_locator() {+ let base = TableDataSelectSqlOptions {+ database_type: Some(DatabaseType::Postgres),+ schema: Some("public".to_string()),+ table_name: "ao_table".to_string(),+ table_type: Some("TABLE".to_string()),+ columns: vec!["id".to_string()],+ limit: Some(20),+ include_row_id: true,+ ..Default::default()+ };++ // Greenplum reports itself through version(); its segments reject+ // tableoid/ctid/xmin with "cannot retrieve a system column" (#13227).+ let greenplum = build_table_data_select_sql(TableDataSelectSqlOptions {+ server_version: Some("PostgreSQL 9.4.24 (Greenplum Database 6.18.2 build commit:4b1c8322)".to_string()),+ ..base.clone()+ });+ assert_eq!(greenplum, "SELECT * FROM \"public\".\"ao_table\" LIMIT 20;");++ // Real Cloudberry `version()` never contains the "greenplum" word.+ let cloudberry = build_table_data_select_sql(TableDataSelectSqlOptions {+ server_version: Some("PostgreSQL 14.4 (Cloudberry Database 1.6.0 build 6f2c4a1)".to_string()),+ ..base.clone()+ });+ assert_eq!(cloudberry, "SELECT * FROM \"public\".\"ao_table\" LIMIT 20;");++ // Plain PostgreSQL and unknown versions keep the locator.+ assert!(build_table_data_select_sql(base.clone()).contains("\"__DBX_ROWID\""));+ assert!(build_table_data_select_sql(TableDataSelectSqlOptions {+ server_version: Some("PostgreSQL 16.3".to_string()),+ ..base+ })+ .contains("\"__DBX_ROWID\""));+}+#[test]fn selects_hidden_postgres_tuple_identity_only_for_known_unkeyed_base_tables() {let base = TableDataSelectSqlOptions {