@crvouga/mockingbird-service-postgres 3.2.0 → 3.4.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +17 -1
  2. package/COMPATIBILITY.md +35 -5
  3. package/README.md +219 -57
  4. package/compat/coverage.json +8 -7
  5. package/compat/divergences.json +37 -2
  6. package/compat/requirements.json +1 -1
  7. package/compat/sections/cat.ts +49 -0
  8. package/compat/sections/ddl.ts +11 -0
  9. package/compat/unsupported-register.json +0 -3
  10. package/dist/admin.js +4812 -987
  11. package/dist/admin.js.map +4 -4
  12. package/dist/api/database.d.ts +11 -0
  13. package/dist/ast/nodes.d.ts +43 -1
  14. package/dist/constraints/enforce.d.ts +2 -0
  15. package/dist/executor/alter-column.d.ts +27 -0
  16. package/dist/executor/comment.d.ts +4 -0
  17. package/dist/executor/ddl.d.ts +1 -2
  18. package/dist/executor/dml.d.ts +2 -0
  19. package/dist/executor/extensions.d.ts +11 -0
  20. package/dist/executor/maintenance.d.ts +25 -0
  21. package/dist/expressions/context.d.ts +1 -1
  22. package/dist/index.d.ts +1 -1
  23. package/dist/index.js +3249 -549
  24. package/dist/index.js.map +4 -4
  25. package/dist/parser/parser.d.ts +9 -0
  26. package/dist/schema/catalog-extensions.d.ts +5 -0
  27. package/dist/schema/extensions.d.ts +33 -0
  28. package/dist/schema/index-catalog.d.ts +40 -0
  29. package/dist/schema/persistence.d.ts +32 -0
  30. package/dist/schema/storage.d.ts +22 -0
  31. package/dist/server.js +5390 -744
  32. package/dist/server.js.map +4 -4
  33. package/dist/sql/deparse-default.d.ts +12 -0
  34. package/dist/sql/deparse-index.d.ts +12 -2
  35. package/dist/sql/keywords.d.ts +6 -0
  36. package/dist/sql/ruleutils.d.ts +27 -0
  37. package/dist/storage/database-state.d.ts +51 -0
  38. package/dist/types/regnamespace.d.ts +23 -0
  39. package/dist/types/value.d.ts +2 -0
  40. package/dist/unstable.js +11520 -8875
  41. package/dist/unstable.js.map +4 -4
  42. package/dist/wire/cli.js +6445 -1260
  43. package/dist/wire/cli.js.map +4 -4
  44. package/dist/wire/cluster.d.ts +8 -0
  45. package/dist/wire/connection.d.ts +38 -0
  46. package/dist/wire/durable.d.ts +82 -0
  47. package/dist/wire/file-storage.d.ts +3 -0
  48. package/dist/wire/fleet.d.ts +210 -1
  49. package/dist/wire/index.d.ts +21 -1
  50. package/dist/wire/index.js +5383 -741
  51. package/dist/wire/index.js.map +4 -4
  52. package/dist/wire/startup.d.ts +36 -0
  53. package/package.json +1 -1
@@ -1,6 +1,10 @@
1
1
  import { type CatalogSection, section } from "../scenario-types.ts";
2
2
 
3
3
  const D = "documented_divergence" as const;
4
+ /** Cases for the ext rows live next to the catalog test, in their own file. */
5
+ const EXTENSIONS = ["tests/contract/catalog/extension-cases.ts"];
6
+ /** Cases for the index / namespace / statistics rows, with the full proof under tests/contract/catalogs/. */
7
+ const INDEXES = ["tests/contract/catalog/index-reconciliation-cases.ts", "tests/contract/catalogs/"];
4
8
 
5
9
  export const CAT_SECTION: CatalogSection = section("CAT", "pg_catalog and information_schema", true, [
6
10
  ["class-01", "user table appears in pg_class with relkind r"],
@@ -27,6 +31,51 @@ export const CAT_SECTION: CatalogSection = section("CAT", "pg_catalog and inform
27
31
  ["cons-01", "information_schema.table_constraints for PK, UNIQUE, CHECK"],
28
32
  ["cons-02", "information_schema.key_column_usage lists key columns"],
29
33
  ["cons-03", "foreign key appears in table_constraints"],
34
+ ["ext-01", "pg_available_extensions lists the installable extensions", undefined, undefined, EXTENSIONS],
35
+ ["ext-02", "an unavailable extension is zero rows in pg_available_extensions", undefined, undefined, EXTENSIONS],
36
+ ["ext-03", "pg_extension follows CREATE / DROP EXTENSION", undefined, undefined, EXTENSIONS],
37
+ ["ext-04", "CREATE EXTENSION of an unavailable extension errors", undefined, undefined, EXTENSIONS],
38
+ ["index-valid-01", "invalid-index filter is empty on a fresh database", undefined, undefined, INDEXES],
39
+ ["index-valid-02", "the pg_index.indisvalid query does not poison a transaction", undefined, undefined, INDEXES],
40
+ ["index-valid-03", "completed indexes are valid, ready and live", undefined, undefined, INDEXES],
41
+ ["index-valid-04", "a failed CREATE UNIQUE INDEX CONCURRENTLY leaves an invalid index", undefined, undefined, INDEXES],
42
+ ["index-valid-05", "CREATE INDEX CONCURRENTLY in a transaction block is 25001", undefined, undefined, INDEXES],
43
+ ["index-valid-06", "REINDEX repairs an invalid index once its duplicates are gone", undefined, undefined, INDEXES],
44
+ [
45
+ "index-valid-07",
46
+ "Database.fault interrupts a concurrent index build",
47
+ D,
48
+ "memory: a test control arms the next concurrent build to fail and leave its index invalid; PostgreSQL does this when a build is canceled or deadlocks, which the oracle cannot be made to do",
49
+ INDEXES,
50
+ "concurrent-index-build-fault",
51
+ ],
52
+ ["index-def-01", "pg_get_indexdef through the pg_index joins", undefined, undefined, INDEXES],
53
+ ["index-def-02", "pg_indexes.indexdef", undefined, undefined, INDEXES],
54
+ ["index-def-03", "constraint-backed indexes appear in every index catalog", undefined, undefined, INDEXES],
55
+ ["index-def-04", "indexdef renders method, ordering, expressions, predicate, quoting", undefined, undefined, INDEXES],
56
+ ["index-def-05", "pg_get_indexdef column and pretty-print overloads", undefined, undefined, INDEXES],
57
+ ["index-comment-01", "COMMENT ON INDEX is stored in pg_description", undefined, undefined, INDEXES],
58
+ ["index-comment-02", "COMMENT ON INDEX of a missing index is 42P01", undefined, undefined, INDEXES],
59
+ ["namespace-01", "relnamespace = current_schema()::regnamespace", undefined, undefined, INDEXES],
60
+ ["namespace-02", "regnamespace output quotes a mixed-case name", undefined, undefined, INDEXES],
61
+ ["namespace-03", "builtin namespace resolves to its catalog oid", undefined, undefined, INDEXES],
62
+ ["namespace-04", "an unknown numeric oid prints numerically", undefined, undefined, INDEXES],
63
+ ["namespace-05", "a missing schema is 3F000", undefined, undefined, INDEXES],
64
+ ["namespace-06", "an oid beyond 2^32-1 is 22003", undefined, undefined, INDEXES],
65
+ ["namespace-07", "a qualified name is invalid name syntax", undefined, undefined, INDEXES],
66
+ ["table-stat-01", "pg_stat_user_tables join on an empty database", undefined, undefined, INDEXES],
67
+ ["table-stat-02", "pg_stat_user_tables lists a new table", undefined, undefined, INDEXES],
68
+ ["table-stat-03", "n_live_tup reflects the rows after ANALYZE; DROP removes the row", undefined, undefined, INDEXES],
69
+ [
70
+ "table-stat-04",
71
+ "statistics are current immediately; activity counters are not tracked",
72
+ D,
73
+ "memory: n_live_tup is the exact row count at once and seq_scan / n_tup_* read zero; PostgreSQL reports its counters asynchronously",
74
+ INDEXES,
75
+ "pg-stat-counters-immediate",
76
+ ],
77
+ ["index-stat-01", "pg_stat_user_indexes on an empty database", undefined, undefined, INDEXES],
78
+ ["index-stat-02", "pg_stat_user_indexes lists an index", undefined, undefined, INDEXES],
30
79
  ["fn-01", "current_database() and current_schema() shapes"],
31
80
  ["fn-02", "version() reports a PostgreSQL banner"],
32
81
  [
@@ -1,6 +1,8 @@
1
1
  import { type CatalogSection, section } from "../scenario-types.ts";
2
2
 
3
3
  const D = "documented_divergence" as const;
4
+ /** Cases for the alter-set rows live next to the catalog test, in their own file. */
5
+ const ALTER_SET = ["tests/contract/catalog/alter-set-cases.ts"];
4
6
 
5
7
  export const DDL_SECTION: CatalogSection = section("DDL", "Schema definition", true, [
6
8
  ["ct-01", "CREATE TABLE with common column types"],
@@ -25,6 +27,15 @@ export const DDL_SECTION: CatalogSection = section("DDL", "Schema definition", t
25
27
  ["alter-02", "DROP COLUMN removes data and star output"],
26
28
  ["alter-03", "RENAME COLUMN"],
27
29
  ["alter-04", "RENAME TABLE"],
30
+ ["alter-set-01", "ALTER COLUMN SET DEFAULT applies to later inserts", undefined, undefined, ALTER_SET],
31
+ ["alter-set-02", "ALTER COLUMN SET NOT NULL flips is_nullable", undefined, undefined, ALTER_SET],
32
+ ["alter-set-03", "ALTER COLUMN SET NOT NULL errors while NULLs exist", undefined, undefined, ALTER_SET],
33
+ ["alter-set-04", "ALTER COLUMN DROP NOT NULL lifts the constraint", undefined, undefined, ALTER_SET],
34
+ ["alter-set-05", "column_default renders SET DEFAULT expressions", undefined, undefined, ALTER_SET],
35
+ ["alter-set-06", "ALTER COLUMN SET STORAGE shows in pg_attribute.attstorage", undefined, undefined, ALTER_SET],
36
+ ["alter-set-07", "SET STORAGE other than PLAIN on a fixed-length column errors", undefined, undefined, ALTER_SET],
37
+ ["alter-set-08", "SET UNLOGGED / SET LOGGED update pg_class.relpersistence", undefined, undefined, ALTER_SET],
38
+ ["alter-set-09", "SET UNLOGGED on a table a logged table references errors", undefined, undefined, ALTER_SET],
28
39
  ["view-01", "CREATE VIEW and query through it"],
29
40
  ["view-02", "view column-alias list"],
30
41
  ["view-03", "view on view"],
@@ -1542,7 +1542,6 @@
1542
1542
  "pg_get_function_result": "internal operator implementation function; the operator itself is the SQL surface",
1543
1543
  "pg_get_function_sqlbody": "internal operator implementation function; the operator itself is the SQL surface",
1544
1544
  "pg_get_functiondef": "internal operator implementation function; the operator itself is the SQL surface",
1545
- "pg_get_indexdef": "internal operator implementation function; the operator itself is the SQL surface",
1546
1545
  "pg_get_keywords": "internal operator implementation function; the operator itself is the SQL surface",
1547
1546
  "pg_get_loaded_modules": "internal operator implementation function; the operator itself is the SQL surface",
1548
1547
  "pg_get_multixact_members": "internal operator implementation function; the operator itself is the SQL surface",
@@ -1691,7 +1690,6 @@
1691
1690
  "pg_split_walfile_name": "server administration / storage / replication introspection; NOT APPLICABLE to an in-memory engine",
1692
1691
  "pg_stat_clear_snapshot": "server administration / storage / replication introspection; NOT APPLICABLE to an in-memory engine",
1693
1692
  "pg_stat_file": "server administration / storage / replication introspection; NOT APPLICABLE to an in-memory engine",
1694
- "pg_stat_force_next_flush": "internal operator implementation function; the operator itself is the SQL surface",
1695
1693
  "pg_stat_get_activity": "internal operator implementation function; the operator itself is the SQL surface",
1696
1694
  "pg_stat_get_analyze_count": "internal operator implementation function; the operator itself is the SQL surface",
1697
1695
  "pg_stat_get_archiver": "internal operator implementation function; the operator itself is the SQL surface",
@@ -2283,7 +2281,6 @@
2283
2281
  "to_oct": "not implemented in this milestone; calls fail loud with SQLSTATE 42883",
2284
2282
  "to_regclass": "not implemented in this milestone; calls fail loud with SQLSTATE 42883",
2285
2283
  "to_regcollation": "not implemented in this milestone; calls fail loud with SQLSTATE 42883",
2286
- "to_regnamespace": "not implemented in this milestone; calls fail loud with SQLSTATE 42883",
2287
2284
  "to_regoper": "not implemented in this milestone; calls fail loud with SQLSTATE 42883",
2288
2285
  "to_regoperator": "not implemented in this milestone; calls fail loud with SQLSTATE 42883",
2289
2286
  "to_regproc": "not implemented in this milestone; calls fail loud with SQLSTATE 42883",