mirror of
https://github.com/morluto/rea.git
synced 2026-11-20 05:32:44 +00:00
fix(sqlite): budget schema names by returned JSON text
Charge the whole-catalog admission guard by escaped decoded names, preserving raw-byte lookup identity and final worker reply limits. Keep UTF-16 inventory and detailed-schema results whose returned facts fit the documented allowance. Fixes #6888
This commit is contained in:
1 parent
3787ec5f83
commit
25aaf89287
5 files changed
+121
-2
No files matched your search
@@ -324,7 +324,7 @@ const readSchema = (
|
||||
// Names bound eventual output only when the whole catalog is requested.
|
||||
// Selected scope retains one table and at most one possible shadow parent;
|
||||
// unrelated names are examined without retaining them or charging the reply.
|
||||
const metadataBudget = new OutputBudget();
|
||||
const catalogNameBudget = new OutputBudget();
|
||||
for (const raw of db
|
||||
.prepare(
|
||||
"SELECT schema, name AS display_name, CAST(name AS BLOB) AS name, type, ncol, wr, strict FROM temp.pragma_table_list WHERE schema = 'main'",
|
||||
@@ -333,7 +333,11 @@ const readSchema = (
|
||||
const value = tableRow.parse(raw);
|
||||
const nameKey = sqliteNameBytesKey(value.name);
|
||||
if (selectedName === undefined) {
|
||||
metadataBudget.retain(nameKey);
|
||||
// The private hex key grows with the database encoding, but is never
|
||||
// returned. Admit catalog names by their decoded JSON representation;
|
||||
// display text is used only for this lower bound, never for identity.
|
||||
// Stored schema bytes still undergo strict decoding below.
|
||||
catalogNameBudget.retain(value.display_name);
|
||||
metadata.set(nameKey, value);
|
||||
} else if (nameKey === selectedKey) {
|
||||
metadata.set(nameKey, value);
|
||||
|
||||
Reference in new issue
Block a user