fix: improve column type precision and SQL correctness across all databases

- PostgreSQL: rewrite column query from information_schema to pg_attribute for accurate type info via format_type(atttypid, atttypmod); extract character_maximum_length from atttypmod for varchar/bpchar; fix execute_query with persistent(false) and empty result fallback
- SQL Server: reconstruct column types with precision (varchar(max), decimal(p,s), datetime2(p)); stop dividing nvarchar/nchar CHARACTER_MAXIMUM_LENGTH by 2
- MySQL: use COLUMN_TYPE instead of DATA_TYPE for full type definitions; add CHARACTER_MAXIMUM_LENGTH; fix ONLY_FULL_GROUP_BY with MIN(NON_UNIQUE)
- Oracle: add CHAR_LENGTH/DATA_LENGTH for column type precision; fix INDEX_OWNER join to prevent cartesian product
- SQLite: fix PRAGMA injection via double-quote escaping; detect primary key indexes via origin column
This commit is contained in:
yavon007 committed 2026-05-03 20:10:35 +08:00
1 parent 26429aa5d6
commit b88e1b8ccb
9 files changed
+135 -50

No files matched your search

+1
View File
@@ -51,6 +51,7 @@ fn duckdb_query_columns(con: &duckdb::Connection, table: &str) -> Result<Vec<db:
extra: None, comment: None,
numeric_precision: None,
numeric_scale: None,
character_maximum_length: None,
})
}).map_err(|e| e.to_string())?;
Ok(rows.filter_map(|r| r.ok()).collect())