Commit Graph
99 Commits
Author SHA1 Message Date
zipg 7091615f8a fix: 修复 PostgreSQL 重载过程显示重复 2026-06-29 19:58:01 +08:00
Guoyu Su 7b32c71b1b fix(postgres): support pg10 routine metadata without prokind 2026-06-28 20:16:25 +08:00
miracleandonceMisery d128604743 fix(connection): 修复数据库连接超时后无法可靠恢复的问题
* feat(core): implement PIP-0001 database connection timeout recovery

- Add DbOperationBudget struct for unified execution budget model
- Add deadpool create/recycle timeout for PostgreSQL pools
- Add checkout_postgres_client helper replacing 14 bare pool.get() calls
  with timeout + cancel token support
- Fix PostgreSQL TLS cancel: rebuild TLS connector from stored context,
  fallback to NoTls on failure
- Add timeout to MySQL kill_query and kill_query_with_opts (5s)
- Extend is_connection_error to match deadpool pool timeout messages
- Unify keepalive default to 30s (was 60s Rust / 0s frontend mismatch)
- Inject PostgreSQL TCP keepalive params (idle=30s, interval=10s, retries=3)
- Inject MySQL tcp_keepalive=30s in OptsBuilder
- Make MySQL inactive_connection_ttl configurable from idle_timeout_secs
- Add stage-based structured logging for pool.checkout/health.check/cancel
- Store PostgresCancelContext in AppState for TLS cancel reconstruction
- Clean up cancel contexts on pool removal/drain
- Add unit tests for DbOperationBudget and pool timeout error detection

* fix(core): align timeout recovery with PIP-0001

* fix(core): handle timeout recovery review issues

* fix(core): complete connection timeout recovery

* fix(core): fall back postgres cancel connector build

* refactor: revert comment translations to English in connection.rs and query.rs

- Revert DbOperationBudget doc comments to English (query.rs)
- Revert PostgresCancelContext and TLS cancel comments to English (connection.rs)
- Keep Chinese error-matching strings in is_connection_error unchanged

---------

Co-authored-by: onceMisery <onceMisery@users.noreply.github.com>
2026-06-26 21:41:56 +08:00
HaoNan Ye 11ed3a0d3b fix(postgres): include public schema in search_path for PostGIS functions (#1817) 2026-06-26 17:58:07 +08:00
LRcoding eb664dba4c fix(core): support fuzzy table search 2026-06-26 13:15:01 +08:00
t8y2 0c0e90ab1a feat(export): add table read cursor sessions 2026-06-25 18:37:04 +08:00
ptma 484d20922a fix(postgres): handle PostgreSQL views 2026-06-25 10:54:38 +08:00
zipgandstaff 902419a3b9 fix(postgres): compatibility with older PostgreSQL versions for table DDL
* Fix: 修复 PostgreSQL CTE DML 分页改写

* fix: 兼容 PostgreSQL 旧版本索引 DDL 查询

---------

Co-authored-by: staff <staff@qimaos-MacBook-Pro.local>
2026-06-24 19:12:28 +08:00
t8y2 23edbe391f feat(postgres): support schema comments 2026-06-24 18:35:43 +08:00
t8y2 f51d622d3f fix(postgres): decode binary address types 2026-06-24 10:55:40 +08:00
t8y2 cebb39cb80 feat(completion): add scoped metadata assistant 2026-06-24 00:40:28 +08:00
hb 3f65297f25 fix(highgo): preserve nullable metadata for pg-compatible agents (#1585) 2026-06-24 00:35:47 +08:00
zipg 1c7ef0d235 feat(mysql): optimize table structure loading 2026-06-23 17:31:37 +08:00
t8y2 280e94e3c1 fix(postgres): avoid backslash LIKE escape 2026-06-23 00:43:10 +08:00
t8y2 0b6e1579ca feat(agent): add execution context recovery 2026-06-22 22:15:16 +08:00
t8y2 0d4e35ee02 fix(core): increase PostgreSQL and MySQL connection pool size
- PostgreSQL: 4 -> 10 connections
- MySQL: 3 -> 10 connections

Fixes #1516
2026-06-21 21:01:15 +08:00
Scars 4590057456 fix(postgres): cast relkind to text to prevent deserialization panic 2026-06-20 22:24:29 +08:00
t8y2 d59997c090 feat(objects): add table statistics columns 2026-06-19 14:35:32 +08:00
t8y2 440e675a0e fix(postgres): retry queries with stale cached prepared statements 2026-06-19 01:04:14 +08:00
ptma e7ee0c9ec1 fix(questdb): handle materialized views and unify table_type naming
* fix(questdb): handle materialized views

* fix(test): fix rust test problems
2026-06-18 11:40:57 +08:00
t8y2 63bb6a21ca fix(mysql): parse geometry WKB to WKT for display and editing 2026-06-17 00:49:33 +08:00
t8y2 c0b7fb5a28 fix(postgres): include sequences in list_objects 2026-06-16 19:20:08 +08:00
t8y2 9b4e16500e fix(postgres): show connection failure details 2026-06-16 01:05:48 +08:00
t8y2 c57e18bf3e fix: resolve clippy warnings and missing struct fields in tests 2026-06-16 00:55:32 +08:00
t8y2 7926da7c0c fix(postgres): disconnect sessions before drop database 2026-06-15 22:02:52 +08:00
t8y2 46ddcaba56 fix: normalize channel_binding=require to prefer for postgres 2026-06-15 17:44:00 +08:00
t8y2 e0d481cc2e fix(postgres): handle tsvector columns 2026-06-15 16:59:01 +08:00
t8y2 30afcb8e69 fix(sidebar): page large table groups 2026-06-13 13:40:36 +08:00
runstone 40f0f98540 Merge branch 'main' of https://github.com/Abeautifulsnow/dbx into feat/ai-agent-loop-phase1 2026-06-12 18:52:05 +08:00
polempandSam ef5ed05ae7 feat(schema-diff): professional DDL diff view with deployment-aware colors and custom themes (#1112)
Co-authored-by: Sam <14344444@@qq.com>
2026-06-12 17:14:05 +08:00
t8y2 2554ed95be fix(postgres): clear statement cache after ddl 2026-06-12 17:11:37 +08:00
Abeautifulsnow 082e3bb4eb feat(ai): add agent tool calling loop 2026-06-12 13:18:36 +08:00
runstone 84a9fd6a0f Merge branch 'main' of https://github.com/Abeautifulsnow/dbx into feat/ai-agent-loop-phase1 2026-06-12 12:52:03 +08:00
t8y2 a858a6bd18 feat(mysql): edit foreign keys and triggers 2026-06-12 12:29:46 +08:00
runstone 61b5e907ce fix(schema): default to public schema for PG and database for MySQL when schema is empty
When the LLM calls `list_tables` tool without a `schema` parameter, the
  backend receives an empty string. This caused PostgreSQL and MySQL
  metadata queries to return no results because:

  - PostgreSQL: `WHERE n.nspname = ''` matches nothing
  - MySQL: `WHERE TABLE_SCHEMA = ''` matches nothing

  Fix by falling back to sensible defaults:
  - PostgreSQL `list_tables`/`get_columns`: empty schema → "public"
  - MySQL `list_tables`: empty schema → database name (MySQL schema == database)
2026-06-12 12:00:27 +08:00
t8y2 51e2ef0d1f fix(postgres): support legacy routine metadata 2026-06-12 00:59:52 +08:00
John Jin 354d21d086 feat(grid): 列是否可排序 (#935) 2026-06-09 16:43:53 +08:00
t8y2 befee2fd4c feat(postgres): support sequence objects 2026-06-08 22:54:14 +08:00
54de28d583 feat(grid): show column data types in result header (#669) (#820)
The data grid header only showed column names, and column types were
available only via tableMeta (open-table view). Arbitrary query results
(e.g. `select * from pg_depend`) therefore showed no type at all, which
is exactly the case the reporter hit.

Backend: add `column_types` to QueryResult (serde-default, backward
compatible) and populate it for the native drivers where the type is
readily available — PostgreSQL, MySQL, SQL Server, ClickHouse. Other
drivers leave it empty for now (no behavior change); schemaless stores
(Mongo/Redis/ES) have no column types.

Frontend: render a type row under each column name in the grid header,
color-coded by type. The type is resolved from tableMeta first (richer,
includes precision) and falls back to the query result's column_types by
index. Add a `showColumnTypesInHeader` setting (default on) and keep the
msgpack tab-result cache compatible. The source-selection logic is
extracted to lib/dataGridColumnType.ts with unit tests.

Co-authored-by: vrustx <vrustx@vrustxdeMac-mini.local>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 22:45:46 +08:00
b64e70753a fix(postgres): render internal "char" type as character, not ASCII code (#669) (#811)
PostgreSQL's internal "char" type (OID 18, e.g. pg_depend.deptype,
pg_shdepend.deptype) is a single byte the driver decodes as i8. In
pg_value_to_json it had no dedicated branch and fell through to the i8
arm below, surfacing the raw ASCII code (110 for 'n') instead of the
character.

Add a "char" branch that renders the byte as its character (matching
psql's charout): a zero byte becomes an empty string, any other byte is
interpreted as a Latin-1 code point so the output is always valid UTF-8
and never panics. SQL standard CHAR(n)/character(n) is a different type
("bpchar") and is unaffected. Added a unit test.

Co-authored-by: vrustx <vrustx@vrustxdeMac-mini.local>
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-07 14:25:04 +08:00
e9ee982843 Preserve ordered SSH and proxy connection layers (#802)
* Preserve ordered SSH and proxy connection layers

Replace separate SSH/proxy connection fields with ordered transport_layers while keeping legacy migration and secret fallback paths intact. The UI now edits SSH tunnel/proxy layers in configured order without a global SSH enable gate.

Constraint: Existing saved SSH tunnels, proxy settings, and secret-store keys must continue to load through migration.
Rejected: Folding proxy fields into SshTunnelConfig | mixes proxy semantics into an SSH-specific structure.
Confidence: high
Scope-risk: moderate
Directive: Keep SSH/proxy structs provider-specific; put cross-layer chaining in transport_layer_tunnel orchestration.
Tested: git diff --check; cargo fmt --check; cargo check --workspace; cargo test -p dbx-core --lib; vue-tsc --noEmit --project apps/desktop/tsconfig.json; tsc -p packages/node-core/tsconfig.json --noEmit; oxlint --vue-plugin apps/desktop/src; tsx --tsconfig apps/desktop/tsconfig.json --test packages/app-tests/*.test.ts; tsx --test packages/node-core/tests/*.test.ts
Not-tested: Live external SSH/proxy/database endpoint integration.

* Keep ordered transport changes CI-format clean

Constraint: CI pnpm check failed only on oxfmt formatting for two desktop TypeScript files
Confidence: high
Scope-risk: narrow
Directive: Keep generated/editor config changes out of this PR fix commit
Tested: PATH="/Volumes/data/code/rust/dbx/node_modules/.bin:/Users/hekx/.codex/tmp/arg0/codex-arg0nuL34n:/Users/hekx/.cargo/bin:/Users/hekx/.local/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/libpq/bin:/Volumes/data/Users/hekx/.opencode/bin:/Users/hekx/.bun/bin:/Volumes/data/sdks/flutter/bin:/Volumes/data/Users/hekx/.cargo/bin:/Users/hekx/.local/bin:/opt/homebrew/opt/llvm/bin:/opt/homebrew/opt/libpq/bin:/Volumes/data/Users/hekx/.opencode/bin:/Users/hekx/.bun/bin:/Volumes/data/Users/hekx/Library/pnpm:/Volumes/data/sdks/flutter/bin:/Volumes/data/Users/hekx/.cargo/bin:/usr/local/bin:/System/Cryptexes/App/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/local/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/bin:/var/run/com.apple.security.cryptexd/codex.system/bootstrap/usr/appleinternal/bin:/pkg/env/global/bin:/opt/X11/bin:/Library/Apple/usr/bin:/Applications/Wireshark.app/Contents/MacOS:/usr/local/go/bin:/opt/homebrew/bin:/opt/podman/bin:/Applications/Ghostty.app/Contents/MacOS" rtk node scripts/run-check.mjs
Not-tested: GitHub Actions rerun not observed locally

* Keep Rust checks warning-clean

Constraint: cargo clippy --workspace --all-targets --all-features -- -D warnings failed across core, web, and tauri crates
Rejected: Broad workspace-level clippy suppression | kept allows local to long-argument command/API boundaries
Confidence: high
Scope-risk: moderate
Directive: Preserve src-tauri/tauri.conf.json as an unrelated local change outside this commit
Tested: rtk cargo clippy --workspace --all-targets --all-features -- -D warnings
Not-tested: Full GitHub Actions rerun not observed locally

* Reuse existing proxy tunnels on retry

Proxy tunnel startup now mirrors SSH tunnel behavior by returning the existing local port for an active connection id instead of replacing the managed handle. A second map check aborts a just-spawned duplicate handle if a concurrent retry won the race before insertion, preventing orphaned listeners while keeping the change narrow.

Constraint: Reviewer requested proxy tunnel behavior align with SSH local-port reuse

Rejected: Always overwrite and abort the previous handle | less consistent with SSH behavior and churns listeners during retries

Confidence: high

Scope-risk: narrow

Tested: cargo fmt --check --all

Tested: cargo test -p dbx-core db::proxy_tunnel::tests::start_tunnel_reuses_existing_local_port

Tested: cargo clippy -p dbx-core --all-targets -- -D warnings

---------

Co-authored-by: hekx <hekx@momandeMac-mini.local>
Co-authored-by: caisin <caisin@caisins-Mac-mini.local>
2026-06-06 23:22:29 +08:00
t8y2 a1d0178a7e fix(postgres): add OpenGauss-compatible index query fallback without WITH ORDINALITY
OpenGauss is based on PostgreSQL 9.2 and does not support WITH ORDINALITY
(PG 9.4+). When the native pg_get_tabledef() path fails, the fallback DDL
builder calls list_indexes() which previously only had two SQL variants, both
using WITH ORDINALITY — causing "syntax error at or near 'WITH'" on OpenGauss.

Add POSTGRES_INDEXES_OPENGAUSS_SQL as a third fallback that uses generate_series
and array_length instead, both available since PG 8.0.
2026-06-06 11:29:16 +08:00
t8y2 249a1ed649 fix(postgres): recover schema session after aborted transaction 2026-06-05 14:46:00 +08:00
t8y2 45cb5f4879 feat(tests): add live Postgres geometry test for rendering geometry values 2026-06-05 01:52:54 +08:00
t8y2 33175c4acd fix(pg): decode pgvector vector columns that displayed as null
pgvector's vector(N) type uses a custom binary format (4-byte header
+ N×4-byte f32 array) that tokio-postgres doesn't natively support.
Add a PgRawBytes adapter and decoder so vector columns render as
JSON float arrays instead of null.
2026-06-04 12:06:02 +08:00
t8y2 94c987c693 fix(metadata): tolerate opengauss column metadata failures 2026-06-03 21:18:34 +08:00
t8y2 1628f2aed4 fix(postgres): avoid hiding inherited tables as partitions 2026-06-02 19:10:28 +08:00
t8y2 cac90c7b62 fix(opengauss): open table structure editor 2026-06-02 18:50:00 +08:00
t8y2 a54c8cfd93 feat(sql): suggest join conditions from foreign keys 2026-06-02 18:08:06 +08:00
t8y2 0e7262eaa3 fix(postgres): display timestamptz in local timezone 2026-06-02 12:04:36 +08:00