fix(oracle): reload large values through rowid-wrapped select

Refs: #7082
This commit is contained in:
t8y2 committed 2026-08-27 10:43:54 +08:00
1 parent 4a3d63b09a
commit afcfa59d0b
4 files changed
+71 -1

No files matched your search

@@ -276,7 +276,21 @@ pub fn build_table_data_select_sql_with_database(
if options.columns.is_empty() {
"*".to_string()
} else {
format!("\"{DBX_ROWID_COLUMN}\", {rownum_select_columns}")
// Callers that address rows by the synthetic key may list it among
// the requested columns; the leading projection already supplies
// it from the inline view, so drop the duplicate.
let rest = options
.columns
.iter()
.filter(|column| !column.eq_ignore_ascii_case(DBX_ROWID_COLUMN))
.map(|column| quote_table_identifier(database_type, column))
.collect::<Vec<_>>()
.join(", ");
if rest.is_empty() {
format!("\"{DBX_ROWID_COLUMN}\"")
} else {
format!("\"{DBX_ROWID_COLUMN}\", {rest}")
}
}
} else {
rownum_select_columns.clone()
+25
View File
@@ -1333,6 +1333,31 @@ fn builds_oracle_and_neo4j_table_data_queries() {
);
}
#[test]
fn builds_oracle_rowid_wrapped_large_value_reload_sql() {
// The data-grid large-value reload selects the synthetic rowid key plus the
// target column with a rowid equality filter; `__DBX_ROWID` exists only as
// the inline-view alias, never as a base-table column (ORA-00904).
assert_eq!(
build_table_data_select_sql(TableDataSelectSqlOptions {
database_type: Some(DatabaseType::Oracle),
schema: Some("APP".to_string()),
table_name: "T_TEST".to_string(),
table_type: Some("TABLE".to_string()),
primary_keys: vec![DBX_ROWID_COLUMN.to_string()],
columns: vec![DBX_ROWID_COLUMN.to_string(), "ELM_CONTENT".to_string()],
where_input: Some("ROWIDTOCHAR(ROWID) = 'AAAFd1AAFAAAABSAA/'".to_string()),
fallback_order_columns: Vec::new(),
order_by: None,
limit: Some(1),
offset: Some(0),
include_row_id: true,
..Default::default()
}),
"SELECT \"__DBX_ROWID\", \"ELM_CONTENT\" FROM (SELECT ROWIDTOCHAR(t.ROWID) AS \"__DBX_ROWID\", t.* FROM \"APP\".\"T_TEST\" t WHERE (ROWIDTOCHAR(ROWID) = 'AAAFd1AAFAAAABSAA/')) WHERE ROWNUM <= 1"
);
}
#[test]
fn oracle_view_first_page_preserves_filter_and_sort_without_rownum() {
assert_eq!(