@crvouga/mockingbird-service-postgres 3.6.0 → 3.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,18 @@
1
1
  # Changelog — @crvouga/mockingbird-service-postgres
2
2
 
3
- ## 3.6.0 (2026-10-16)
3
+ ## 3.8.0 (2026-10-19)
4
+
5
+ ### Features
6
+
7
+ - resolve the agent-reported issue queue in one batch ([25c52b6](https://github.com/crvouga/mockingbird/commit/25c52b668a53ddb80b968419601a20abf33f956b))
8
+
9
+ ## 3.7.0 (2026-10-16)
10
+
11
+ ### Features
12
+
13
+ - resolve fleet and emulator issue batch ([26d2f8c](https://github.com/crvouga/mockingbird/commit/26d2f8cee99fefed93192204bac44fb1be35c1da))
14
+
15
+ ## 3.6.0 (2026-10-15)
4
16
 
5
17
  ### Features
6
18
 
package/COMPATIBILITY.md CHANGED
@@ -100,11 +100,12 @@ The oracle exposes **2787 builtin functions** and **74 operators** in `pg_catalo
100
100
  | Materialized view indexes | PARTIALLY VERIFIED | Ordinary/partial/unique indexes, creation before population, catalog links, unique enforcement and atomic failure on refresh, snapshot roundtrip. Physical access methods and concurrent refresh are not modelled (`tests/contract/views/materialized-indexes.test.ts`) |
101
101
  | Constraint triggers | PARTIALLY VERIFIED | AFTER ROW multi-event triggers, DEFERRABLE INITIALLY DEFERRED/IMMEDIATE, final-state execution at commit, failed-commit rollback, SET CONSTRAINTS and savepoints; definitions survive snapshots, pending events cannot be exported. Uses the existing plpgsql-lite subset (`tests/contract/triggers/deferred.test.ts`, `tests/wire/deferred.test.ts`) |
102
102
  | Triggers (row-level, LANGUAGE sql-expressible) | PARTIALLY VERIFIED | Creation-order firing, `UPDATE OF` ignored, no INSTEAD OF (documented) |
103
+ | Statement triggers and transition tables | PARTIALLY VERIFIED | `BEFORE` / `AFTER` `FOR EACH STATEMENT` triggers on `INSERT`, `UPDATE` and `DELETE` fire once per statement in trigger-name order, also when no row changes (`INSERT ... ON CONFLICT DO UPDATE` fires the `INSERT` and the `UPDATE` ones). `AFTER` triggers take `REFERENCING { OLD \| NEW } TABLE [AS] name` for one `INSERT`, `UPDATE` or `DELETE` event: the body reads the statement's rows (`OLD` and `NEW` position-aligned for `UPDATE`) as relations with the table's columns, quoted names stay case-sensitive, and `pg_trigger.tgoldtable` / `tgnewtable` and snapshots carry them. The clause errors match PostgreSQL (`42P17` for BEFORE, wrong event, duplicate or equal names; `0A000` for several events, column lists, `TRUNCATE`, `ROW` variables). Not modelled: `FOR EACH ROW` triggers with transition tables (`0A000`), statement triggers for `TRUNCATE` and for cascaded foreign-key actions (`tests/contract/triggers/transition-tables.test.ts`, `tests/wire/issue-465-466.test.ts`) |
103
104
  | CREATE FUNCTION LANGUAGE sql / plpgsql-lite | PARTIALLY VERIFIED | Scalar + set-returning; plpgsql subset: DECLARE, EXCEPTION WHEN others, CASE, FOR-IN-SELECT, RETURN NEXT |
104
105
  | Text search (tsvector / tsquery / @@ / ts_rank) | PARTIALLY VERIFIED | `simple`-style config; no ispell/synonym dictionaries |
105
106
  | `CREATE EXTENSION pgcrypto` / `digest()` | PARTIALLY VERIFIED | `digest(bytea, text)` and `digest(text, text)` for md5, sha1, sha224, sha256, sha384, sha512. `crypt`, `hmac`, `gen_salt`, and PGP functions are not installed. OpenSSL-only names (sha3, blake2, ripemd160, sm3) are not available. Extensions other than `pgcrypto` and `pg_trgm` still fail loud (`0A000`) |
106
107
  | `pg_available_extensions`, `pg_available_extension_versions`, `pg_extension` | VERIFIED | List exactly what `CREATE EXTENSION` can install here: `pgcrypto` (1.3, 1.4), `pg_trgm` (1.3 to 1.6) and the built-in `plpgsql` (1.0), with `installed_version`, schema and version following `CREATE` / `DROP EXTENSION`, rollback and snapshots. A stock PostgreSQL server lists every contrib module it ships; those are absent here (zero rows, and `CREATE EXTENSION` is `0A000`). An older version installs the same partial function set as the default one. `DROP EXTENSION` reports dependents (`2BP01`) and `CASCADE` removes dependent defaults, generated columns, CHECK constraints, views and indexes; `DROP EXTENSION plpgsql` and `ALTER EXTENSION` fail loud (`0A000`) (`tests/contract/extensions/catalogs.test.ts`) |
107
- | `CREATE EXTENSION pg_trgm` | PARTIALLY VERIFIED | `similarity(text, text)`, `<%` at the default word-similarity threshold 0.6, and a single-column `gin_trgm_ops` index on `text` or `varchar`. `gist_trgm_ops`, multicolumn `gin_trgm_ops`, and non-default thresholds are not installed. |
108
+ | `CREATE EXTENSION pg_trgm` | PARTIALLY VERIFIED | `similarity(text, text)`, `<%` at the default word-similarity threshold 0.6, and a single-column `gin_trgm_ops` index on a `text` or `varchar` column or expression (`lower(name) public.gin_trgm_ops`; an expression of another type is `42804`, an unknown column or function inside it fails as in PostgreSQL). `gist_trgm_ops`, multicolumn `gin_trgm_ops`, and non-default thresholds are not installed. |
108
109
  | COPY FROM/TO (text, csv) | VERIFIED | Via `copyFrom` API hook / rows out |
109
110
  | PREPARE / EXECUTE / DEALLOCATE, SET / SHOW / RESET | VERIFIED | GUC subset, including PostgreSQL dump and migration-client preambles |
110
111
  | Transactions / savepoints | VERIFIED | No `25P02` aborted state (documented divergence) |
@@ -141,3 +142,34 @@ PostgreSQL; clock profiles are supported. This adds fleet orchestration around e
141
142
  snapshot semantics, not a broader SQL compatibility claim. Acceptance evidence is
142
143
  `packages/adapters/node/fleet.management.test.ts` using the unmodified `pg` wire client.
143
144
  See [Fleets](../../../docs/FLEETS.md).
145
+
146
+ ## Schema preflight and row-version metadata
147
+
148
+ `analyzeSchema(sql, options)` (the package's main export) checks plain schema SQL in a discarded
149
+ in-memory database and returns a JSON-serializable report, including the installed build version,
150
+ statement offsets/lines/columns, object names, SQLSTATEs, independent failures and identifiable
151
+ missing prerequisites. Defaults cap input at 1 MiB, statements at 1,000 and diagnostics at 100;
152
+ configurable hard caps are 4 MiB, 10,000 and 1,000. It does not execute data statements, contact an
153
+ oracle or change an existing database. Accepted statements remain explicitly **unknown** for full
154
+ semantic compatibility, including deferred SQL/PL/pgSQL bodies and dynamic SQL. A detected gap sets
155
+ `compatible: false`; otherwise it stays `null`, never a claim of a verified import. Source-tree
156
+ execution identifies the version as `source-tree`; published builds embed their package version.
157
+ Lexical errors that prevent reliable statement recovery terminate the scan.
158
+
159
+ SQL and PL/pgSQL function definitions retain comma-separated `SET` lists (including `search_path`),
160
+ apply them during calls and restore the caller's settings on return or error. Portable snapshots
161
+ retain these settings. Sequence functions accept explicit `regclass` input, and
162
+ `pg_get_serial_sequence` finds owned serial, identity and explicitly owned sequences using exact
163
+ column-name case; ownership follows sequence/table/column renames and snapshots.
164
+
165
+ Stored tables expose `xmin` and `alias.xmin` as hidden `xid` system columns. INSERT, UPDATE, upsert,
166
+ COPY and referential-action writes stamp row versions with a local transaction identity; explicit
167
+ transactions share that identity, including wire workspace replay and commit. Rollback restores
168
+ committed row metadata. Snapshots preserve identities and continue allocation above retained IDs;
169
+ legacy PGMM snapshots without metadata expose frozen xid `2`. Each database/namespace owns its
170
+ allocator. These identities are version markers, not permanent globally unique row identifiers.
171
+ The implementation does not add full MVCC, VACUUM/freeze maintenance, physical tuple metadata or
172
+ xid wraparound management; it fails when the 32-bit allocation space is exhausted.
173
+
174
+ Evidence: `tests/contract/regressions/issue-queue.test.ts` (PostgreSQL 18.3 differential contracts),
175
+ `tests/contract/api/schema-report.test.ts`, and `tests/wire/issue-queue.test.ts`.
package/README.md CHANGED
@@ -529,6 +529,11 @@ search, `ON CONFLICT DO NOTHING/UPDATE`, `RETURNING`, `PREPARE`/`EXECUTE`/`DEALL
529
529
 
530
530
  ## API
531
531
 
532
+ `analyzeSchema(sql, options?)` returns bounded, JSON-serializable schema compatibility diagnostics
533
+ without changing an application database. Accepted statements remain semantically unverified;
534
+ see [schema preflight and row-version metadata](COMPATIBILITY.md#schema-preflight-and-row-version-metadata)
535
+ for limits, the report contract and `xmin` support.
536
+
532
537
  Stable runtime exports of the main entry:
533
538
 
534
539
  | Export | Description |