Skip to content

Commit 901f666

Browse files
committed
docs: document PostgreSQL compatibility workflow
1 parent 2dcc0d4 commit 901f666

2 files changed

Lines changed: 62 additions & 1 deletion

File tree

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,26 @@ make build-sqlengine # Interactive SQL CLI
6464
make build-corpus-test # Corpus validation harness
6565
```
6666

67+
### PostgreSQL compatibility harness
68+
69+
ParserSQL uses `libpg_query` as the PostgreSQL syntax oracle for compatibility checks. The harness pins `libpg_query` `17-latest` and `18-latest`, extracts accepted PostgreSQL regression statements, and compares ParserSQL behavior against the committed PostgreSQL 18 baseline in [`docs/compatibility/postgresql-18.md`](docs/compatibility/postgresql-18.md).
70+
71+
Compatibility results separate full parser parity from classification coverage:
72+
73+
- `DEEP_SUPPORTED` means ParserSQL accepted the statement with the expected statement type and a full AST.
74+
- `CLASSIFIED_ONLY` means ParserSQL recognized the top-level statement class, but did not produce full deep parser parity for that SQL.
75+
- `PARTIAL`, `ERROR`, `TRAILING_INPUT`, and `TYPE_MISMATCH` are tracked separately in the committed baseline.
76+
77+
The report includes the full PostgreSQL 18 backlog, the PG17-to-PG18 release delta, statement routing coverage, and reviewed structural grammar/keyword changes.
78+
79+
```bash
80+
make test-pg-compat # Build the pinned oracle runner, run harness unit tests, and replay committed CI cases
81+
make pg-compat # Run the full pinned PG17/PG18 comparison against the committed baseline
82+
make pg-compat-refresh # Regenerate expected_results.jsonl, ci_cases.jsonl, and docs/compatibility/postgresql-18.md
83+
```
84+
85+
`PG_COMPAT_CACHE` controls where external `libpg_query` and PostgreSQL source checkouts are cached. It defaults to `/tmp/parsersql-pg-compat`.
86+
6787
### Interactive CLI (`sqlengine`)
6888

6989
```bash

docs/benchmarks/REPRODUCING.md

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Step-by-step instructions to reproduce all comparison benchmarks from scratch on
99
```bash
1010
# Required tools
1111
sudo apt-get update
12-
sudo apt-get install -y build-essential git curl
12+
sudo apt-get install -y build-essential git curl tar bzip2
1313

1414
# Rust (for sqlparser-rs benchmark)
1515
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y
@@ -19,6 +19,9 @@ source ~/.cargo/env
1919
g++ --version # need GCC 8+ (C++17 support)
2020
cargo --version # need Rust 1.70+
2121
git --version
22+
curl --version
23+
tar --version
24+
python3 --version
2225
```
2326

2427
---
@@ -76,6 +79,44 @@ ls -la third_party/libpg_query/libpg_query.a
7679

7780
---
7881

82+
## PostgreSQL Compatibility Harness
83+
84+
The PostgreSQL compatibility harness uses pinned `libpg_query` builds as the syntax oracle. It compares ParserSQL against PostgreSQL 17 and PostgreSQL 18 regression SQL, writes a committed PostgreSQL 18 baseline, and reports the PG17-to-PG18 syntax delta in `docs/compatibility/postgresql-18.md`.
85+
86+
Required external tools:
87+
88+
```text
89+
git
90+
curl
91+
tar with bzip2 support
92+
python3
93+
C/C++ compiler
94+
make
95+
```
96+
97+
`PG_COMPAT_CACHE` controls where external sources and built oracle runners are cached. It defaults to `/tmp/parsersql-pg-compat`.
98+
99+
```bash
100+
# Fast deterministic gate: unit tests plus committed CI cases
101+
make test-pg-compat
102+
103+
# Full pinned PG17/PG18 comparison against committed expected_results.jsonl
104+
make pg-compat
105+
106+
# Refresh committed artifacts after intentionally updating pins or mappings
107+
make pg-compat-refresh
108+
```
109+
110+
The harness result model distinguishes parser depth from statement routing:
111+
112+
- `DEEP_SUPPORTED` means ParserSQL accepted the SQL with the expected statement type and a full AST.
113+
- `CLASSIFIED_ONLY` means ParserSQL recognized the top-level statement class, but did not reach full parser parity for that SQL.
114+
- `PARTIAL`, `ERROR`, `TRAILING_INPUT`, and `TYPE_MISMATCH` are committed baseline outcomes that must not regress silently.
115+
116+
The refresh target updates `tests/pg_compat/expected_results.jsonl`, `tests/pg_compat/ci_cases.jsonl`, and `docs/compatibility/postgresql-18.md`.
117+
118+
---
119+
79120
## Step 4: Build the comparison benchmark
80121

81122
```bash

0 commit comments

Comments
 (0)