Skip to content

feat(postgres): support PostgreSQL in odc-client (issue #850)#29

Open
LordofAvernus wants to merge 4 commits into
dev-4.3.4from
feature-850
Open

feat(postgres): support PostgreSQL in odc-client (issue #850)#29
LordofAvernus wants to merge 4 commits into
dev-4.3.4from
feature-850

Conversation

@LordofAvernus
Copy link
Copy Markdown

Summary

ODC 前端 4.3.4 分支接入 PostgreSQL 支持,覆盖 issue #850 的 odc-client 侧改动:

  • 启用 PG 数据源前端 features 与配置(DataSource Type 列表加入 PG,按后端能力开关)。
  • pg-language Monaco 插件:实现 PG SQL 编辑高亮 / Tokenizer。
  • features.task 与资源树(Trigger / Sequence / Type)按后端 PostgreSQLFeatures 收敛对齐(compat-RISK-3 决策 A,确保前端不展示 PG 不支持的对象类型,避免点开后调用后端 404)。

关联 issue: actiontech/dms-ee#850
关联文档: docs/spec/design.md §3.5 / §8.1 / §8.2,docs/dev/compat_risks.md §compat-RISK-3

Test plan

  • pnpm build 通过
  • DMS 创建 PG 数据源后 ODC SQL Console 资源树仅展示 schema / table / view / function / procedure,不再出现 trigger / sequence / type 节点
  • PG 表 / 视图打开后编辑器使用 pg-language 高亮,关键字 / 函数名识别正确

sjjian and others added 4 commits March 12, 2026 04:58
…nfiguration

Enable PostgreSQL datasource to have full workbench functionality, aligning with SQLServer configuration:
- Enable features: sessionManage, sessionParams, sqlExplain, plRun, groupResourceTree, sqlconsole
- Add task types: ASYNC, SQL_PLAN, IMPORT, EXPORT, EXPORT_RESULT_SET, STRUCTURE_COMPARISON, MULTIPLE_ASYNC
- Set SQL language to 'pg' for Monaco editor
- Add system schemas: information_schema, pg_catalog
- Disable enableTableCharsetsAndCollations and enableAutoIncrement (PG uses SERIAL/IDENTITY)
- Change date type to 'timestamp' for PG compatibility
…L editing

- Create pg-language Monaco plugin directory structure
- Implement PostgreSQL keywords list (reserved.ts)
- Implement PostgreSQL built-in functions (string, datetime, math, aggregate, window, json, system, array)
- Implement Monarch syntax highlighter with PostgreSQL specific features:
  - Dollar-quoted strings ($$...$$ and $tag$...$tag$)
  - E-string (E'...') with backslash escapes
  - Double-quoted identifiers
  - Nested block comments
- Implement simpleParser for SQL context parsing (completion and hover)
- Implement autoComplete provider with table/column/schema/function completion
- Implement hover provider for DDL display
- Implement service layer for data access (getTableList, getTableColumns, getSchemaList, etc.)
- Register pg-language plugin in MonacoEditor/index.tsx
- Support dynamic loading when language='pg'
- Merge TO_TIMESTAMP function definitions into single polymorphic entry
- Remove duplicate CASE keyword in reserved.ts
- Remove duplicate FUNCTION/PROCEDURE keywords in trigger section
…kend (issue #850, compat-RISK-3)

Refs: #850
Risk: compat-RISK-3

- src/common/datasource/pg/index.tsx: 收敛 PG features.task 至仅含
  TaskType.ASYNC(移除 SQL_PLAN / DATA_ARCHIVE / DATA_DELETE / IMPORT /
  EXPORT / EXPORT_RESULT_SET / STRUCTURE_COMPARISON / MULTIPLE_ASYNC),
  与 ODC 后端 PostgreSQLFeatures + odc_version_diff_config 对齐,避免
  用户点击后看到 unsupported;其它 features 字段(sessionManage /
  sessionParams / sqlExplain / plRun / groupResourceTree / sqlconsole /
  obclient / recycleBin / export)保持原状。
- src/page/Workspace/SideBar/ResourceTree/DatabaseSearchModal/constant.ts:
  PG 资源搜索对象类型从 [table, column, function, view, trigger] 收敛为
  [table, column, function, view],与 ODC 后端 support_trigger=false
  一致;MySQL / Oracle / OB-Mysql / DORIS / SQL Server /
  SEARCH_OBJECT_FROM_ALL_DATABASE 等其它分支保持原状。
- 新增单元测试(map case 形式)覆盖:PG features.task === [ASYNC]、
  PG 其它 features 字段不变、PG 资源搜索数组 === [table,column,function,view]、
  PG 不再含 trigger / sequence / type / synonym / package 等扩展类型,
  以及 MySQL / Oracle / OB-Mysql / DORIS / SQL Server 等横向基线不回归。

落点:design.md §3.5 / §4.2 / §8.1 / §8.2 / §10.3。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants