Context
This issue tracks Tasks 7-8 from docs/superpowers/plans/2026-06-11-postgresql-libpg-query-compatibility.md and follows #51.
Task 7: reviewed witnesses and metadata validation
Implemented on PR #50 in commit 1f9122e test: add reviewed PostgreSQL syntax witnesses.
Added
tests/pg_compat/witnesses.sql
tests/pg_compat/witnesses.json
tests/pg_compat/structural_dispositions.json
Updated
scripts/pg_compat/baseline.py
tests/pg_compat/test_baseline.py
Behavior
- Parses witness SQL through a target
pg_compat runner via load_reviewed_witnesses().
- Validates metadata count against parsed SQL statement count.
- Rejects duplicate witness IDs.
- Rejects unsupported
first_postgresql_major values above the target major.
- Requires
structural_feature_ids to be present and a list of strings.
- Rejects oracle node mismatches against
expected_oracle_node.
- Reports empty feature links as
unlinked_witnesses for later refresh review.
Seed witnesses
pg-json-object-constructor: SQL/JSON constructor through SELECT.
pg-merge-statement: PostgreSQL MERGE statement currently surfaced by ParserSQL as TYPE_MISMATCH.
Task 8: Markdown compatibility reports
Implemented on PR #50 in commit 7663f51 feat: generate PostgreSQL compatibility reports.
Added
scripts/pg_compat/generate_report.py
tests/pg_compat/test_generate_report.py
Report content
- PostgreSQL target-version header.
- Generation timestamp.
- ParserSQL commit.
- Previous and target
libpg_query branches, SHAs, and PostgreSQL patch versions.
- Result totals for all six compatibility outcomes.
- PG18 backlog excluding
DEEP_SUPPORTED.
CLASSIFIED_ONLY routing coverage.
- PG17-to-PG18 release delta outcomes.
- Newly supported and regressed baseline transitions.
- Structural feature witness links.
- Unwitnessed structural features.
- Unlinked witnesses.
- Reproduction commands.
Determinism
- Statement rows sort by result, oracle node, and statement ID.
- Structural feature rows sort by kind, symbol, and feature ID.
- SQL shown in Markdown is normalized and limited to 200 characters; complete SQL remains in JSONL inputs.
Verification
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s tests/pg_compat -p "test_baseline.py" -v: 13 tests passed.
- Actual PG18 runner accepted both seed witnesses; SQL/JSON was
DEEP_SUPPORTED, MERGE was TYPE_MISMATCH.
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s tests/pg_compat -p "test_generate_report.py" -v: 2 tests passed.
PYTHONDONTWRITEBYTECODE=1 PG_COMPAT_RUNNER=/tmp/parsersql-pg-compat-test/bin/pg_compat-18 python3 -m unittest discover -s tests/pg_compat -p "test_*.py" -v: 79 tests passed.
Status
Implementation is complete on PR #50. The issue will close when that PR merges.
Context
This issue tracks Tasks 7-8 from
docs/superpowers/plans/2026-06-11-postgresql-libpg-query-compatibility.mdand follows #51.Task 7: reviewed witnesses and metadata validation
Implemented on PR #50 in commit
1f9122e test: add reviewed PostgreSQL syntax witnesses.Added
tests/pg_compat/witnesses.sqltests/pg_compat/witnesses.jsontests/pg_compat/structural_dispositions.jsonUpdated
scripts/pg_compat/baseline.pytests/pg_compat/test_baseline.pyBehavior
pg_compatrunner viaload_reviewed_witnesses().first_postgresql_majorvalues above the target major.structural_feature_idsto be present and a list of strings.expected_oracle_node.unlinked_witnessesfor later refresh review.Seed witnesses
pg-json-object-constructor: SQL/JSON constructor through SELECT.pg-merge-statement: PostgreSQL MERGE statement currently surfaced by ParserSQL asTYPE_MISMATCH.Task 8: Markdown compatibility reports
Implemented on PR #50 in commit
7663f51 feat: generate PostgreSQL compatibility reports.Added
scripts/pg_compat/generate_report.pytests/pg_compat/test_generate_report.pyReport content
libpg_querybranches, SHAs, and PostgreSQL patch versions.DEEP_SUPPORTED.CLASSIFIED_ONLYrouting coverage.Determinism
Verification
PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s tests/pg_compat -p "test_baseline.py" -v: 13 tests passed.DEEP_SUPPORTED, MERGE wasTYPE_MISMATCH.PYTHONDONTWRITEBYTECODE=1 python3 -m unittest discover -s tests/pg_compat -p "test_generate_report.py" -v: 2 tests passed.PYTHONDONTWRITEBYTECODE=1 PG_COMPAT_RUNNER=/tmp/parsersql-pg-compat-test/bin/pg_compat-18 python3 -m unittest discover -s tests/pg_compat -p "test_*.py" -v: 79 tests passed.Status
Implementation is complete on PR #50. The issue will close when that PR merges.