@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.
- package/dist/engine/database.d.ts +6 -0
- package/dist/engine/database.js +391 -93
- package/dist/engine/optimizer.js +168 -87
- package/dist/engine/query.d.ts +98 -0
- package/dist/engine/query.js +1457 -162
- package/dist/engine/sql-domains.d.ts +11 -0
- package/dist/engine/sql-domains.js +56 -0
- package/dist/engine/sql-functions.js +129 -3
- package/dist/engine/sql-json.d.ts +2 -0
- package/dist/engine/sql-json.js +4 -0
- package/dist/engine/sql-semantics.d.ts +9 -1
- package/dist/engine/sql-semantics.js +19 -3
- package/dist/engine/vector.js +29 -13
- package/dist/plan/model.d.ts +14 -2
- package/dist/storage/indexeddb.js +9 -1
- package/dist/storage/memory.d.ts +2 -1
- package/dist/storage/memory.js +29 -4
- package/dist/storage/toolkit/record-core.js +15 -3
- package/dist/testing/sqllogictest.js +3 -1
- package/package.json +1 -1
- package/postgres-feature-profile.json +9 -4
- package/sql-feature-matrix.json +543 -6
|
@@ -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
|
-
|
|
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 (
|
|
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
|
-
|
|
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.
|
|
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": "
|
|
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
|
|
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
|
|
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": "
|
|
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",
|