@crvouga/postgres-mem 1.1.0 → 1.1.2

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/AGENTS.md CHANGED
@@ -147,7 +147,7 @@ Requires [Bun](https://bun.sh).
147
147
 
148
148
  ```bash
149
149
  bun install
150
- bun run ci:local # same gates as GitHub Actions CI (except publish)
150
+ bun run check:full # same gates as GitHub Actions CI (except publish)
151
151
  bun run check # format + lint + typecheck + postgres-compat suite
152
152
  bun run format
153
153
  bun run lint
package/README.md CHANGED
@@ -223,6 +223,7 @@ Fuzz / property tests use a fixed seed (`0x5a17e0e1`) and print it on failure:
223
223
 
224
224
  ```bash
225
225
  bun test tests/fuzz
226
+ bun run test:pbt:random -- 50 # N random seeds, fail fast on first mismatch
226
227
  POSTGRES_MEM_FUZZ_SEED=12345 bun test tests/fuzz
227
228
  POSTGRES_MEM_FUZZ_SEED=12345 POSTGRES_MEM_FUZZ_PATH='0:1' bun test tests/fuzz # exact replay
228
229
  ```
@@ -282,7 +283,7 @@ Parity is proven by differential contracts against real PostgreSQL — default o
282
283
 
283
284
  ```bash
284
285
  bun install
285
- bun run ci:local # same gates as GitHub Actions CI (except publish)
286
+ bun run check:full # same gates as GitHub Actions CI (except publish)
286
287
  bun run check # format + lint + typecheck + postgres-compat suite
287
288
  bun run format # write Biome formatting
288
289
  bun run lint # Biome lint
@@ -317,7 +318,7 @@ PR titles must also follow Conventional Commits (enforced in CI). Prefer squash
317
318
  Local checks:
318
319
 
319
320
  ```bash
320
- bun run ci:local # commitlint + quality + tests + browser + benchmarks
321
+ bun run check:full # commitlint + quality + tests + browser + benchmarks
321
322
  # dry-run needs a GitHub token for API calls; CI publish uses Trusted Publishing (no NPM_TOKEN)
322
323
  bun run release:dry-run
323
324
  ```
@@ -121,13 +121,6 @@
121
121
  "specifiedBehavior": "Single-column IN subqueries have full parity; multi-column row-value subquery comparison is out of scope for this milestone and fails loud.",
122
122
  "pinnedBy": ["PAR-row-03", "EXP-in-03"]
123
123
  },
124
- {
125
- "id": "unary-minus-folding",
126
- "scope": "sql",
127
- "predicate": "Repeated unary minus is folded into the numeric literal during parse, so '- -5' is rejected; PostgreSQL evaluates it to 5",
128
- "specifiedBehavior": "Use parentheses (-(-5)) for nested negation.",
129
- "pinnedBy": ["PAR-neg-01"]
130
- },
131
124
  {
132
125
  "id": "float8-overflow-saturates",
133
126
  "scope": "sql",
@@ -50,12 +50,5 @@ export const PAR_SECTION: CatalogSection = section("PAR", "Parser & grammar", tr
50
50
  ["param-01", "Positional $n parameters"],
51
51
  ["depth-01", "Deeply nested parentheses"],
52
52
  ["reserved-01", "Reserved words misused as identifiers error"],
53
- [
54
- "neg-01",
55
- "Nested unary minus on numeric literals",
56
- D,
57
- "memory folds repeated unary minus into the literal text and rejects it; PostgreSQL evaluates - -5 to 5",
58
- undefined,
59
- "unary-minus-folding",
60
- ],
53
+ ["neg-01", "Nested unary minus on numeric literals"],
61
54
  ]);
@@ -1107,7 +1107,6 @@
1107
1107
  "jsonb_object_field": "not implemented in this milestone; calls fail loud with SQLSTATE 42883",
1108
1108
  "jsonb_object_field_text": "not implemented in this milestone; calls fail loud with SQLSTATE 42883",
1109
1109
  "jsonb_out": "type I/O / wire-protocol support function; not part of the SQL dialect surface",
1110
- "jsonb_path_exists": "not implemented in this milestone; calls fail loud with SQLSTATE 42883",
1111
1110
  "jsonb_path_exists_opr": "not implemented in this milestone; calls fail loud with SQLSTATE 42883",
1112
1111
  "jsonb_path_exists_tz": "not implemented in this milestone; calls fail loud with SQLSTATE 42883",
1113
1112
  "jsonb_path_match": "not implemented in this milestone; calls fail loud with SQLSTATE 42883",
@@ -53,6 +53,9 @@ export type PlStmt = {
53
53
  targets: string[];
54
54
  query: SelectStmt;
55
55
  body: PlStmt[];
56
+ } | {
57
+ kind: "sql";
58
+ text: string;
56
59
  };
57
60
  export interface PlDecl {
58
61
  name: string;
@@ -18,7 +18,7 @@ export interface ScopeExtras {
18
18
  export declare function makeEvalScope(env: ExecEnv, scope: RowScope | null, extras?: ScopeExtras): EvalScope;
19
19
  export declare function evalScalar(env: ExecEnv, scope: RowScope | null, e: Expr, extras?: ScopeExtras): TypedValue;
20
20
  /** SQL three-valued predicate: null → false */
21
- export declare function evalPredicate(env: ExecEnv, scope: RowScope | null, e: Expr, extras?: ScopeExtras): boolean;
21
+ export declare function evalPredicate(env: ExecEnv, scope: RowScope | null, e: Expr, extras?: ScopeExtras, kind?: string): boolean;
22
22
  export declare function resolveUserFunction(env: ExecEnv, name: string[], argCount: number): FunctionData | null;
23
23
  /** Prefer a UDF whose declared types accept the actual args via implicit cast. */
24
24
  export declare function resolveUserFunctionForArgs(env: ExecEnv, name: string[], args: TypedValue[]): FunctionData | null;
@@ -37,7 +37,9 @@ export interface SortSpec {
37
37
  }
38
38
  export declare function sortRows(env: ExecEnv, rel: Relation, specs: SortSpec[]): void;
39
39
  export declare function executeBody(env: ExecEnv, body: SelectBody): Relation;
40
- export declare function executeCore(env0: ExecEnv, core: SelectCore, orderBy: OrderByItem[]): Relation;
40
+ export declare function executeCore(env0: ExecEnv, core: SelectCore, orderBy: OrderByItem[], opts?: {
41
+ hasLimit?: boolean;
42
+ }): Relation;
41
43
  export declare function executeSelectStmt(env0: ExecEnv, stmt: SelectStmt): Relation;
42
44
  export declare function selectResult(env: ExecEnv, stmt: SelectStmt): ExecResult;
43
45
  export {};
@@ -33,6 +33,10 @@ export interface EvalScope {
33
33
  export declare function evalExpr(ctx: EngineCtx, scope: EvalScope, e: Expr): TypedValue;
34
34
  export declare function numberLitValue(raw: string): TypedValue;
35
35
  export declare function toBool(ctx: EngineCtx, v: TypedValue): boolean | null;
36
+ /** WHERE/HAVING/ON/etc. predicates must already be boolean (or unknown); null → false. */
37
+ export declare function evalAsPredicate(ctx: EngineCtx, kind: string, v: TypedValue): boolean;
38
+ /** Plan-time: validate AND/OR/NOT operands are boolean (PG 42804), including short-circuited branches. */
39
+ export declare function checkBoolExprType(ctx: EngineCtx, scope: EvalScope, e: Expr, kind: string): void;
36
40
  /** Domain NOT NULL + CHECK constraints, with VALUE bound to the cast result. */
37
41
  export declare function applyDomainChecks(ctx: EngineCtx, domainKey: string, value: TypedValue): void;
38
42
  export declare function anyAllCompare(ctx: EngineCtx, op: string, left: TypedValue, rights: TypedValue[], kind: "any" | "all"): TypedValue;