You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task.
4
+
5
+
**Goal:** Close PostgreSQL-supported syntax and analysis gaps that currently fail in omni's PG parser/catalog loader.
6
+
7
+
**Architecture:** Add focused regression tests in `pg/catalog` or `pg/parser` for each PG-supported construct, verify they fail for the expected reason, then make the narrowest parser/catalog/analyzer change for each root cause. Keep each change scoped to the component that rejects behavior PostgreSQL accepts.
8
+
9
+
**Tech Stack:** Go, `go test`, omni `pg/parser`, omni `pg/catalog`.
10
+
11
+
### Task 1: Zero-column table and `MATCH SIMPLE`
12
+
13
+
**Files:**
14
+
- Modify: `pg/catalog/tablecmds.go`
15
+
- Modify: `pg/parser/create_table.go`
16
+
- Test: `pg/catalog/loader_compat_test.go`
17
+
18
+
**Step 1: Write the failing tests**
19
+
20
+
Add tests that call `LoadSQL` for `CREATE TABLE t ();` and a foreign key using `MATCH SIMPLE`.
21
+
22
+
**Step 2: Run tests to verify they fail**
23
+
24
+
Run: `go test ./pg/catalog -run 'TestLoaderCompat' -count=1`
25
+
Expected: zero-column table fails with `tables must have at least one column`; `MATCH SIMPLE` fails near `SIMPLE`.
26
+
27
+
**Step 3: Implement minimal fixes**
28
+
29
+
Remove the catalog rejection for zero-column regular tables. Update `parseKeyMatch` to consume the `SIMPLE` token as well as identifier text.
30
+
31
+
**Step 4: Run tests to verify they pass**
32
+
33
+
Run: `go test ./pg/catalog -run 'TestLoaderCompat' -count=1`
34
+
Expected: PASS.
35
+
36
+
### Task 2: Function comments and `RETURNS TABLE`
37
+
38
+
**Files:**
39
+
- Modify: `pg/parser/define.go` or relevant function argument parser
40
+
- Modify: `pg/catalog/functioncmds.go`
41
+
- Test: `pg/catalog/loader_compat_test.go`
42
+
43
+
**Step 1: Write failing tests**
44
+
45
+
Add tests for `COMMENT ON FUNCTION f(arg_name integer)` and `RETURNS TABLE(...) LANGUAGE plpgsql`.
46
+
47
+
**Step 2: Verify red**
48
+
49
+
Run targeted `go test` and confirm failures are from named argument parsing or return validation.
50
+
51
+
**Step 3: Implement minimal fixes**
52
+
53
+
Accept optional argument names in `ObjectWithArgs` type lists and keep locating comments by argument type OIDs. Align `RETURNS TABLE` return validation with PostgreSQL's OUT parameter behavior.
54
+
55
+
**Step 4: Verify green**
56
+
57
+
Run the targeted loader compatibility test.
58
+
59
+
### Task 3: View analyzer expression gaps
60
+
61
+
**Files:**
62
+
- Modify: `pg/catalog/analyze.go`
63
+
- Test: `pg/catalog/loader_compat_test.go`
64
+
65
+
**Step 1: Write failing tests**
66
+
67
+
Add view tests for `concat_ws(text, variadic any)`, `jsonb ->> c.col_name` with `unnest(text[])` alias, CTE range resolution, and later LATERAL alias scope.
68
+
69
+
**Step 2: Verify red**
70
+
71
+
Run targeted tests and record exact failing analyzer path for each case.
72
+
73
+
**Step 3: Implement one analyzer fix per failure**
74
+
75
+
Use PostgreSQL-compatible type inference and range-table scope handling. Keep changes narrow and do not add broad fallback typing unless the test proves the exact missing behavior.
76
+
77
+
**Step 4: Verify green**
78
+
79
+
Run targeted tests, then relevant analyzer/view regression tests.
80
+
81
+
### Task 4: Index partition attach and FK type compatibility
82
+
83
+
**Files:**
84
+
- Modify: `pg/catalog/alter.go`
85
+
- Modify: `pg/catalog/constraint.go`
86
+
- Test: `pg/catalog/loader_compat_test.go`
87
+
88
+
**Step 1: Write failing tests**
89
+
90
+
Add tests for `ALTER INDEX parent ATTACH PARTITION child` and bigint FK referencing integer PK.
91
+
92
+
**Step 2: Verify red**
93
+
94
+
Run targeted tests and confirm whether failure is relation lookup, index parent metadata, or type compatibility direction.
95
+
96
+
**Step 3: Implement minimal fixes**
97
+
98
+
Fix partitioned parent index lookup/metadata and align FK compatibility with PostgreSQL's accepted implicit coercion direction.
99
+
100
+
**Step 4: Verify green**
101
+
102
+
Run targeted tests and partition/FK regression tests.
0 commit comments