@minnowdb/core 0.7.1 → 0.7.5

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.
@@ -1655,6 +1655,8 @@ class RecordCore {
1655
1655
  const active = activePostingStorageColumnIds(currentTable);
1656
1656
  if (!active.has(column.columnId))
1657
1657
  continue;
1658
+ if (column.postings.length === 0)
1659
+ continue;
1658
1660
  const key = `${changes.tableId}/${column.columnId}`;
1659
1661
  const deltas = this.#ftsDeltas.get(key) ?? /* @__PURE__ */ new Map();
1660
1662
  if (!deltas.has(version) && deltas.size >= MAX_FTS_DELTA_CHUNKS) {
@@ -4330,8 +4332,11 @@ class RecordCore {
4330
4332
  this.#nextAutoIncrement.set(key, next);
4331
4333
  for (const [key, base] of cloned.ftsBases)
4332
4334
  this.#ftsBases.set(key, base);
4333
- for (const [key, deltas] of cloned.ftsDeltas)
4334
- this.#ftsDeltas.set(key, new Map(deltas));
4335
+ for (const [key, deltas] of cloned.ftsDeltas) {
4336
+ const retained = deltas.filter(([, delta]) => delta.postings.length > 0);
4337
+ if (retained.length > 0)
4338
+ this.#ftsDeltas.set(key, new Map(retained));
4339
+ }
4335
4340
  for (const [tableId, tokens] of cloned.uniqueKeys) {
4336
4341
  this.#uniqueKeys.set(tableId, new OrderedStringSet(tokens));
4337
4342
  }
@@ -5425,7 +5430,14 @@ function validateRecordCoreState(state, physical) {
5425
5430
  throw new TypeError(`Full-text delta ${key} repeats a version`);
5426
5431
  versions.add(version);
5427
5432
  whole(delta.totalTokens, `Full-text delta ${key} token count`);
5428
- if (validateFtsPostingChunks([delta.postings], `Full-text delta ${key}`) !== delta.totalTokens) {
5433
+ if (!Array.isArray(delta.postings)) {
5434
+ throw new TypeError(`Full-text delta ${key} postings must be an array`);
5435
+ }
5436
+ if (delta.postings.length === 0) {
5437
+ if (delta.totalTokens !== 0) {
5438
+ throw new TypeError(`Empty full-text delta ${key} must have a zero token total`);
5439
+ }
5440
+ } else if (validateFtsPostingChunks([delta.postings], `Full-text delta ${key}`) !== delta.totalTokens) {
5429
5441
  throw new TypeError(`Full-text delta ${key} token total does not match its postings`);
5430
5442
  }
5431
5443
  }
@@ -166,7 +166,9 @@ function parseExpected(lines, file, line) {
166
166
  return { kind: "hash", valueCount, hash: (match[2] ?? "").toLowerCase() };
167
167
  }
168
168
  function tokenizeDirective(line) {
169
- return line.trim().split(/\s+/u);
169
+ const hash = line.indexOf("#");
170
+ const directive = hash === -1 ? line : line.slice(0, hash);
171
+ return directive.trim().split(/\s+/u);
170
172
  }
171
173
  function sqlLines(lines) {
172
174
  return lines.map((line) => line.text).join("\n");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minnowdb/core",
3
- "version": "0.7.1",
3
+ "version": "0.7.5",
4
4
  "description": "A columnar SQL database for the browser: PostgreSQL-style SQL over durable IndexedDB or OPFS data, with no server or WebAssembly module.",
5
5
  "license": "MIT",
6
6
  "author": "Eric Wilhite",
@@ -31,7 +31,7 @@
31
31
  {
32
32
  "id": "expression.arithmetic",
33
33
  "classification": "different",
34
- "reason": "Minnow has one JavaScript number type: integer-looking division stays fractional, and division by zero returns NULL instead of raising PostgreSQL's error."
34
+ "reason": "Division by zero returns NULL instead of raising PostgreSQL's error. Integer division itself follows PostgreSQL: two integer operands truncate toward zero."
35
35
  },
36
36
  {
37
37
  "id": "expression.round",
@@ -43,6 +43,11 @@
43
43
  "classification": "extension",
44
44
  "reason": "PostgreSQL uses $n parameters. Minnow also accepts ? as adapter-friendly shorthand."
45
45
  },
46
+ {
47
+ "id": "mutation.truncate",
48
+ "classification": "different",
49
+ "reason": "TRUNCATE reports the number of rows it removed, where PostgreSQL's command tag carries no count. The resulting table state is identical."
50
+ },
46
51
  {
47
52
  "id": "mutation.upsert-replace",
48
53
  "classification": "extension",
@@ -91,7 +96,7 @@
91
96
  {
92
97
  "id": "expression.modulo",
93
98
  "classification": "different",
94
- "reason": "Minnow permits % on its number type; PostgreSQL has no % operator for double precision."
99
+ "reason": "Minnow permits % on double precision values; PostgreSQL has no % operator for double precision."
95
100
  },
96
101
  {
97
102
  "id": "expression.date-trunc",
@@ -101,7 +106,7 @@
101
106
  {
102
107
  "id": "function.numeric-core",
103
108
  "classification": "different",
104
- "reason": "Minnow's one number type accepts combinations that PostgreSQL's distinct integer, numeric, and double-precision overloads do not."
109
+ "reason": "Minnow's numeric functions accept integer, exact, and double-precision arguments interchangeably, where PostgreSQL's distinct integer, numeric, and double-precision overloads do not."
105
110
  },
106
111
  {
107
112
  "id": "function.string-extended",
@@ -247,7 +252,7 @@
247
252
  {
248
253
  "id": "transaction.isolation-level",
249
254
  "classification": "inapplicable",
250
- "reason": "Minnow exposes one snapshot transaction model, so there is no session isolation level to configure."
255
+ "reason": "Every transaction reads one snapshot and commits atomically, which satisfies READ UNCOMMITTED, READ COMMITTED, and REPEATABLE READ, so those levels are accepted and ignored. SERIALIZABLE promises more than one snapshot can, and is refused rather than silently downgraded."
251
256
  },
252
257
  {
253
258
  "id": "privileges.grant",