Skip to content

feat: SearchVectors inequality filters - #1449

Merged
LeeroyHannigan merged 105 commits into
mainfrom
feat/search-inequality-filters
Nov 26, 2026
Merged

LeeroyHannigan merged 105 commits into
mainfrom
feat/search-inequality-filters

Conversation

@demohan

@demohan demohan commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

What

SearchVectors accepts the extended SearchConditionExpression grammar: the comparators <>, <, <=, > and >=, BETWEEN, IN, OR, NOT, parentheses, attribute_exists and attribute_not_exists, and more than one condition on an attribute, up to 50 conditions with the HASH equality among them. DynamoDB accepts this grammar on the accounts and regions measured (us-east-1, eu-north-1, ap-southeast-2), although its API reference documents only =. ExtendDB accepted only an AND of equalities.

ExtendDB serves the grammar by default. The search_inequality_filters runtime setting takes all, off or a comma-separated list of account IDs; an absent or empty value is every account, and settings get and settings list show the default all. With off, or for an account the list leaves out, a search condition is an AND of equalities, compared exactly as before. The expression map checks below apply under every setting and in every build.

The code is behind the search-inequality-filters Cargo feature, in the default list of the seven crates that declare it, the browser build's adapter among them. The workspace takes the engine and the server without their default features, so the server's feature turns on the engine's and the app's turns on the server's: a server or app built without it neither serves the grammar nor has the setting. devtools/compile-out-search-inequality-filters removes the feature from those lists, and CI builds, lints, unit-tests and wire-tests that tree. A build without the feature refuses the setting and serves the equality-only grammar, with the map checks. SQLite and PostgreSQL serve the grammar; MongoDB and Cassandra refuse SearchVectors as before, now ahead of the IAM decision.

SearchVectors sets no dynamodb:Attributes value, as DynamoDB does, and makes the checks that need no table before the IAM decision.

This PR replaces #1322 and carries its change, with its author on the commit.

Storage seam

VectorSearch gains item_filter, an optional VectorItemFilter that a backend calls on candidates, keeping the first top_k that match: SQLite on each candidate before scoring it, PostgreSQL on the rows its SQL returns in score order, page by page. ADR 0006 records that only the partition predicate and the inline-filter equalities stay in SQL. filters holds the equalities on String and Binary values that the backend applies in its own query, and every other condition arrives as item_filter. Every existing caller passes None, and with None both backends run the statement and the loop they ran before.

Grammar and checks in core

The search condition has its own lexer, grammar and checks in crates/core/src/expression/search_filter, next to the parser that ConditionExpression, FilterExpression, KeyConditionExpression and UpdateExpression use, because extending that parser would change the answers of those expressions. The service answers a malformed SearchConditionExpression with Syntax error; token: "<token>", near: "<text>", where the near text is the token before, the offending token and the token after. The core search_filter unit tests pass 48 conditions of at most 4096 bytes that the search grammar refuses with that syntax error, each expectation measured on the service. On those 48, the existing parser gives the same answer on 2, its own wording such as unexpected end of expression, expected ')' or expression nesting depth exceeded on 33, and another token or near text on none, and it accepts 13 (a number operand, a name that starts with _). The service parses a condition nested as deep as the 4096-byte limit allows: 4089 unclosed ( get the syntax error at <EOF>, and 818 nested NOT( get the operator count. The existing parser recurses and refuses past max_expression_depth (150 by default) with expression nesting depth exceeded, which the upgrade manual documents. The service answers ConditionExpression (PutItem) and FilterExpression (Scan) with the same syntax error text as SearchConditionExpression on 13 such shapes, and accepts 151 and 160 nested NOT ( and (a) = :v there too (eu-north-1, 2026-11-25, each twice), so an extension to the service's syntax error and depth would change those operations' answers, and one that kept their answers would need a mode at the tokenizer, at each error site, at the depth rule and at the reserved-word check. ADR-0031 records the decision. The grammar applies the search rules after the condition grammar: each comparison, BETWEEN, IN and function is one condition, at most 50, the HASH equality included; IN lists and BETWEEN bounds hold values only; nested paths and other functions are refused. Once the index is known, it requires one must-match = on the HASH attribute, allows ordering operators only on Number attributes, and checks each value's type, in that order.

  • Numbers in the inline filter compare as the nearest binary64 value of each side, as the service does. 9007199254740992 and 9007199254740993 are equal; 1000000000000000 and 1000000000000001 differ. Condition, filter and key condition expressions keep exact comparison, and a test pins that.
  • The parser, the checks and the drop of the parsed tree run without recursion. The lowering to Expr, the evaluator and the drop of the lowered Expr recurse once per level, and the 300-operator limit bounds them at 300 levels: 299 nested NOT( and 299 NOT answer 200 with the right result.
  • The BETWEEN bound check, the operand display, the map key checks (validate_placeholder_key), the usage checks (validate_expression_param_usage), the expression size check (check_expression_size, with a new SearchConditionExpression kind) and the name size check (validate_expression_attribute_name_sizes, with a new SearchRequest form) are the ones the other operations use. So max_expression_length_bytes and max_attribute_name_bytes of [limits] apply to SearchVectors. A Binary BETWEEN bound now shows as B: and its base64 in ConditionExpression too, as on the service ({B:Ag==}, measured on ConditionExpression, FilterExpression and SearchConditionExpression), where it showed B:<binary>.
  • One function lists the unused keys of either map, and the names in use come from the tokens of the projection and of each grammar.
  • The combined size of the expression and its substitutions, counted at each use, is at most 1,048,576 bytes; each distinct substitution is sized once. The sum saturates, so on a 32-bit target, the browser build, a 4 MiB value used 1,024 times answers the size refusal instead of wrapping to 0; the core step of devtools/run-wasm-step runs that test.
Engine: request checks and grammar dispatch
  • ExpressionAttributeNames and ExpressionAttributeValues are checked once TopK and SearchVector are valid, before the projection, the search condition and the table lookup: empty maps (names first), empty names, names over max_attribute_name_bytes, empty keys, keys over 255 bytes, keys that are not placeholders, and maps sent without the expression that uses them. A name that neither expression uses is refused ahead of unused values and the index schema checks.
  • A condition is parsed with both grammars. When both refuse it with the same error, or both accept it and give the backend the same search, the setting is not read. The server checks the request before the IAM decision and hands the checked request to the handler, so a request that passes is parsed once.
  • When both grammars parse a condition, the equality pairs come from the extended parse, with names resolved and parentheses read as grouping, so Country = :c AND (Cat) = :s reaches the backend as ("Cat", S:x). The equality-only grammar reads (Cat) as an attribute named (Cat); it still answers for an account the setting leaves out.
  • An equality-only condition stays a set of backend equality pairs, so PostgreSQL keeps its SQL equality filter and LIMIT. A Number equality goes to the item filter and compares as binary64.
  • The engine's SearchVectors unit tests build their in-memory SQLite engine and context through one helper, test_context.rs, which the PartiQL tests use too.
Authorization
  • dynamodb:Attributes carries no value on SearchVectors, whatever ProjectionExpression and SearchConditionExpression name. On DynamoDB a Deny gated on Null true refused every search, a projected one included, and a Deny on an attribute refused none (measured 2026-11-21).
  • A bare negated operator over the absent key matches on a SearchVectors, as IAM matches one on an absent key: a Deny gated on StringNotEquals {"dynamodb:Attributes": "x"} refuses every search, and an Allow gated on it grants the search. The other operations, and dynamodb:LeadingKeys, keep the no-match rule. This follows from the 2026-11-21 measurement and IAM's absent-key answer for dynamodb:Attributes; that Deny and that Allow were not sent to DynamoDB, because a session policy needs an IAM write.
  • The checks that need no table (the body, IndexName, SearchVector, TopK, the expression maps, the projection and the search condition) run before the IAM decision, once the table name passes its pattern check. A caller a policy denies now gets ValidationException for a TopK of 0 or a names key without #, where it got AccessDeniedException. On a backend without vector search the refusal SearchVectors is not supported by this storage backend is one of those checks: on MongoDB a caller denied dynamodb:SearchVectors gets it, where 1.0.0 answered AccessDeniedException. A request that fails those checks records the latency segments of /metrics, as a request that fails in the engine does.
The search_inequality_filters setting

Each server installs its settings store against its own storage. A server reads the setting only for a search whose answer depends on the grammar, at most once a second, so a change applies within about a second, and a change through the management API applies at the next read. A search depends on the grammar when one grammar refuses its condition and the other accepts it or refuses it with another message, or when both accept it and would give the backend different searches: an inequality, a condition on a Number inline filter, a parenthesised condition, a value written first, an attribute twice, more than 19 conditions. An AND of at most 19 equalities on String and Binary attributes, written as 1.0.0 accepted them, never reads it.

A server sends at most one read of the setting at a time, across changes through the management API too, so a catalog that does not answer holds one of its connections for the setting. Once a read has answered, a request never waits on a read another request sent: while a read is in flight, it uses the value of the last read that answered. Before any read has answered, a request waits on the read in flight until two seconds after it was sent, and then answers ServiceUnavailable (HTTP 503) at once; a read that does not end delays only the first requests. When a read fails or does not end within two seconds, the server uses the value of its last read that answered. Every lock on the server list and the kept read recovers from poisoning, and a test poisons each one, last included. Measured on PostgreSQL 16 with the catalog behind a proxy that holds every read of the key: 25 changes, each followed by an inequality search, leave one held read, the searches after the first answer in about 20 ms, and GetItem, DescribeTable, ListTables and CreateTable answer 200; before this change each change held one more read, and once the 20 connections of the catalog pool were held every request answered HTTP 500 after 30 s.

An absent or empty value, and a server that has not installed its store, enable every account; the browser build installs none. off enables none and a list enables the caller it names. A request on a table of another account is refused before the grammar is chosen. A malformed value cannot be written through the CLI or the management API, whose refusal names each accepted form; one found in the catalog is logged once per change and enables no account. settings get, settings list and the console's settings page show the default all when the catalog has no row. The admin guide lists the setting.

off and the Cargo feature differ when the setting cannot be read. Before a read has answered, a server cannot know that the value is off, so under off a search whose answer depends on the grammar still waits for the read and answers ServiceUnavailable when it fails: on PostgreSQL with the read held from start, Country = :c AND Price = :p, which 1.0.0 served, answered 503 after 2 s, and the build with the feature compiled out answered it 200. Answering with the equality grammar then would give an account on all the exact comparison for those seconds, a grammar the setting does not name for it. A build without the feature never reads the setting, so no SearchVectors answer depends on a read of the setting.

The setting follows the DynamoDB API rule of docs/versioning.md: a change that makes ExtendDB answer a request as DynamoDB answers it is a bug fix and ships in a minor release. Its default, all, is the service's answer, which changes earlier answers: the extended conditions are served, and a Number in a condition compares as binary64. off keeps the earlier grammar. The configuration rule, that a key a minor release adds has a default that keeps the earlier behavior, does not hold for this key.

Storage backends
  • SQLite applies the item filter in its candidate loop.
  • PostgreSQL reads a filtered search in pages of the score ordering. Each page is the ordering after the last row of the page before, compared on the score and the whole base key, with a limit, and carries only each row's score and address. The search stops once top_k rows match, and a dropped request cancels its statement.
  • The PostgreSQL settings store reads search_inequality_filters for a search with lock_timeout 1 s and statement_timeout 1.5 s for that read only, through a new SettingsStore::get_setting_bounded, whose default is get_setting. On a connection outside a transaction block the read opens and commits its own transaction; inside one, which only its owner may end, it runs under a savepoint and rolls back to it. A read behind a held lock fails in the server and returns its connection, also when the caller has dropped it. Other settings reads, those of the management API, extenddb settings get and list, and the server's startup reads, are the plain reads of 1.0.0.
  • The cancel of a dropped filtered scan checks the backend process id and the transaction start. That narrows the window in which a transaction-pooling proxy could hand the backend to another client between the check and the signal; it does not close it.
Wire tests

test_search_vectors_inequality_filters.py, test_search_vectors_condition_limit.py, test_search_vectors_expression_maps.py and test_search_vectors_deep_conditions.py run against ExtendDB and against DynamoDB; the first searches with parenthesised String, Binary and Number operands. test_search_vectors_metrics.py runs against ExtendDB only and counts the /metrics latency segments of searches that fail their checks. The modules read the setting and never change it, expect the extended grammar when it is absent and the equality-only grammar from a build without the setting, and fail when the server serves the other grammar. EXTENDDB_EXPECT_VECTORS=1 turns a vector refusal into a failure and =0 requires one. The test headers state where and when each expected answer was measured. test_authz_search_vectors_index.py states that its four deny(null) order rows were not sent to DynamoDB under that policy, and names the measurements they rest on.

CI and devtools

The other workflows build, lint and test the feature through the defaults, and the PostgreSQL and SQLite pytest steps of integration.yml run the SearchVectors suites under the extended grammar with EXTENDDB_EXPECT_VECTORS=1. search-inequality-filters.yml covers the rest. Its compiled-out job first runs devtools/compile-out-search-inequality-filters --check on, which checks with cargo tree, for the host and for wasm32-unknown-unknown, that the browser build (extenddb-wasm-adapter) enables the feature on the engine, core and the SQLite backend, then compiles the feature out of the seven default lists and checks that nothing enables it on any target, then runs clippy 1.97.0 on the workspace and the unit tests of core, the engine, the server and the app. The script writes no manifest unless it finds the expected number of crates. Its wire job runs devtools/run-tests --extenddb --pytest --parallel --filter "vector and not test_cli" against SQLite and PostgreSQL servers with the setting at off and as a list naming the test account and an account the tests do not use, and against the compiled-out build. A summary check requires both jobs.

Three devtools changes support it. With --filter, devtools/run-tests now passes the CLI lifecycle and the backup store wire suites when pytest selects no test in them (exit code 5), so a filter aimed at the vector suites does not fail them; a mistyped filter therefore passes those two suites as well. devtools/provision-test-credentials now prints EXTENDDB_TEST_ACCOUNT_ID. devtools/run-tests writes the setting from EXTENDDB_TEST_SEARCH_INEQUALITY_FILTERS before the suites start; with the variable unset it writes nothing, and a refusal names both causes (a build without the feature, a value the key does not take). The new PostgreSQL tests fail instead of skipping when EXTENDDB_TEST_PG_REQUIRED is set and no connection string reaches them. The search-inequality-filters summary check is not yet among the checks main requires.

Why

DynamoDB serves these conditions and ExtendDB refused them, and SearchVectors answered several malformed requests that DynamoDB refuses.

Fixes #729 (the names map and dynamodb:Attributes), under every setting.
Fixes #1317 (a values key without :), under every setting.
Fixes #1320 (an unused name), under every setting.
Fixes #1318 (the expression size limit). Fixes #1319 (##c). Both fixes apply to an account the extended grammar serves, every account by default. With off, or for an account a list leaves out, the equality-only grammar has no size check and resolves ##c through #c, as before.
Refs #1461 and #1462, two known differences below.

Replaces #1322.

Known differences

This branch has six known differences from DynamoDB. Each predates this change, in code that other operations share or in the order of the checks:

  1. ProjectionExpression syntax errors use ExtendDB's wording (2 measured shapes).
  2. An empty AttributeValue in ExpressionAttributeValues answers ValidationException "Supplied AttributeValue is empty, must contain exactly one of the supported datatypes", where DynamoDB answers SerializationException (2 measured shapes).
  3. A bad ReturnConsumedCapacity value carries the 1 validation error detected: prefix, which DynamoDB omits on SearchVectors (1 measured shape).
  4. A request without TopK answers SerializationException "Start of structure or map found where not expected: missing field TopK", where DynamoDB answers ValidationException "missing field TopK at line 1 column N", also ahead of its authorization decision (SearchVectors: a request without TopK answers SerializationException #1461).
  5. The table name is checked first, against its pattern only: DynamoDB answers TopK 0 and a two-character IndexName ahead of a refused table name, then checks the table name's length (3 to 255) and pattern without the 1 validation error detected: prefix, then the maps and the condition. ExtendDB serves a SearchVectors table name of 2 or 256 characters and answers ResourceNotFoundException (SearchVectors: table name checks answer in a different order and miss the length bounds #1462).
  6. ConditionExpression and FilterExpression keep their own syntax error wording and depth limit, refuse parenthesised operands such as (Cat) = :s and attribute_exists((Cat)), accept a name that starts with _, and word the function errors their own way; the service answers them as it answers SearchConditionExpression (see the grammar section). This PR does not change those operations.

Testing done

Live measurements

DynamoDB, every request shape sent at least twice, request and response recorded; the test modules' headers give the region and date of each answer they assert:

  • eu-north-1: the condition catalog (comparators, BETWEEN, IN, OR, NOT, functions, HASH rules, type checks, limits, maps); the request-check order (maps, projection, unused names and values, TopK, vector dimension); depth, the leading underscore, BETWEEN bound pairs, parenthesised operands, function arguments and function types on two tables; equality-only shapes (Number equality at 2^53, 0.3 and 38-digit neighbours, String case, trailing space and Unicode composition, Binary, numeric HASH) and result-order shapes; the cases of the grammar, rules and schema unit tests, and accepted partition shapes.
  • eu-north-1, 2026-11-25: the combined size at 1,048,574 to 1,048,578 and 1,048,600 bytes, with and without a name (200 up to 1,048,576, the size refusal from 1,048,577); BETWEEN bounds of 14 type pairs on SearchConditionExpression, FilterExpression and ConditionExpression (a Binary bound shows as base64 in all three); ##c = :v with {"#c": "cat"} and two neighbours; malformed ConditionExpression and FilterExpression shapes on a table name that does not exist.
  • eu-north-1, 2026-11-25: parenthesised operands ((Cat) = :s, (Country) = :c, (#k) = :s, (Price) = :p, a Binary (Bin) = :b, :s = (Cat), ((Cat)) = :s), function arity and update functions, String BETWEEN bounds out of order and #a_b, each as SearchConditionExpression and as Scan FilterExpression; names outside [A-Za-z0-9_] with and without ExpressionAttributeNames, whitespace characters, 4096 and 4097 bytes, a 2102-byte values key, the projection against a missing table, a missing index and a wrong dimension, the HASH and inline Number equality at 2^53, and the ANDs of equalities that read the setting.
  • us-east-1 and ap-southeast-2: =, >, BETWEEN, IN, OR with NOT, and attribute_exists with <>, each twice. Every request answered 200 with the items the condition selects.
  • us-east-1, 2026-11-25, on a table name that does not exist: one 65,533-byte name #x0 in 17 conditions #x0 = :s AND ... (1,114,277 bytes) answers the size refusal, and in 15 conditions (983,185 bytes) ResourceNotFoundException.
  • eu-north-1 and us-east-1: ExpressionAttributeNames shapes. {"n": ""} gets the empty-name message, {"": "cat"} gets contains an empty key;, and {"n": <65536 bytes>} gets the name-too-large message, each ahead of the key syntax error. A map with two bad keys names either key, varying between runs.
  • us-east-1, 2026-11-21, under session policies (measured with the change from fix(engine): refuse a malformed ExpressionAttributeNames map on SearchVectors #1322): a Deny gated on Null true on dynamodb:Attributes refused every SearchVectors sent, a projected one included; a Deny on ssn served a search that projected ssn and one whose condition named it. No request under a policy on a bare negated operator was sent.
  • eu-north-1: the HASH equality with 49 inline conditions answers 200 and with 50 answers "number of conditions: 51, maximum: 50"; a request without TopK answers ValidationException "missing field TopK".
  • The four wire modules against DynamoDB in eu-north-1, twice, from the tip: 81 passed and 1 skipped (the backend-without-vectors case) in both runs. The expression maps module in us-east-1, twice: 9 passed in both runs.

Local checks on the tip

The tip merges main at 0485203.

On the tip, release servers, each shape twice: with the setting absent and with all, SQLite and PostgreSQL each equal the recorded DynamoDB answers on every shape of the catalogs above except six, which are the shapes of the first four known differences.

  • cargo fmt --all -- --check: clean.
  • clippy 1.97.0 --all-targets -D warnings: the workspace with default features, the two feature sets of clippy.yml, the binary with --no-default-features and each of sqlite, mongodb, cassandra, sqlite-memory,dev-mode, sqlite,dev-mode and mongodb-test-hooks, and -p extenddb-server -p extenddb-app --no-default-features: clean. cargo package --workspace --no-verify --locked: clean. The workspace with the feature compiled out: clean. devtools/run-wasm-step build, clippy, guard and pedantic: clean.
  • Rust 1.94.0 cargo build --locked --workspace: clean.
  • cargo test --locked --workspace --no-fail-fast with PostgreSQL 16 and pgvector required: 86 test binaries and 14 doc-test runs, 5,595 passed, 0 failed, 99 ignored. With the feature compiled out, the tests of core, the engine, the server, the app, auth, storage, the SQLite and PostgreSQL backends and the browser adapter: 61 test binaries and 9 doc-test runs, 4,436 passed, 0 failed.
  • The four SearchVectors wire modules, test_authz_search_vectors_index.py and test_search_vectors_metrics.py, on SQLite and PostgreSQL: with the setting absent, all, or a list naming the test account, 115 passed and 1 skipped; off 91 passed and 25 skipped; the compiled-out SQLite and PostgreSQL builds 91 passed and 25 skipped. MongoDB and Cassandra refuse SearchVectors: the refusal test and the metrics test pass (2 passed, 114 skipped).
  • PostgreSQL 16 with the catalog behind a proxy that holds every read of search_inequality_filters: 25 changes through the management API, each followed by an inequality search, leave one held read, and GetItem, DescribeTable, ListTables and CreateTable answer 200; with the read held from start, the requests after the first answer at once.
  • On MongoDB, a caller denied dynamodb:SearchVectors gets the backend refusal (1.0.0: AccessDeniedException), each request twice.
  • With max_expression_length_bytes 8192 and max_attribute_name_bytes 100000, SearchVectors with a 5,008-byte condition and with a 70,000-byte name answers as Scan and GetItem do; with the default limits it answers the measured refusals.
  • Each new test fails with its fix reverted.

Review

Round Angle Verdict Blocking Major Minor
1 Mechanism and concurrency NOT READY 1 4 2
1 Parity with DynamoDB NOT READY 1 1 0
1 Tests and controls READY WITH FIXES 0 10 8
Verify Mechanism and concurrency READY WITH FIXES 0 0 1
Verify Parity with DynamoDB READY 0 0 0
Verify Tests and controls READY WITH FIXES 0 1 1
2 Mechanism, configuration and upgrade READY WITH FIXES 0 3 6
2 Parity with DynamoDB READY WITH FIXES 0 1 4
2 Tests and controls READY WITH FIXES 0 2 4
Verify 2 Mechanism, configuration and upgrade READY 0 0 0
Verify 2 Parity with DynamoDB READY 0 0 0
Verify 2 Tests and controls READY 0 0 0
Code owner DynamoDB answers, mechanism, tests, size and conflicts CHANGES REQUESTED 0 10 20
Second code owner DynamoDB answers, mechanism, configuration, tests and docs COMMENTED 3 8 7

Checklist

  • I have read CONTRIBUTING.md
  • All tests pass (cargo test --workspace)
  • Code is formatted (cargo fmt --check)
  • Clippy is clean (cargo clippy -- -W clippy::pedantic)
  • I have added or updated tests for new functionality
  • I have updated documentation if behavior changed
  • Breaking changes are noted below (if any)
  • If this changes the wire protocol, Storage trait, auth model, on-disk
    format, or public CLI surface, an RFC has been accepted or is linked
    below. Otherwise, an ADR captures the decision (link below).

Clippy is clean with -D warnings, which CI runs. -W clippy::pedantic reports 1,831 warnings in the eight crates this PR touches, 24 of them on lines it adds, of the kinds the surrounding code has (missing backticks in documentation, HashMap parameters not generic over the hasher, one argument passed by value).

ADR / RFC: ADR-0031, added in this PR.

Breaking changes

  • The expression map checks apply to SearchVectors under every setting and in every build: a malformed names or values key, an empty map or name, a name over max_attribute_name_bytes, a map no expression uses and a name no expression uses are refused with ValidationException, where earlier releases served the request. off does not restore these answers.
  • A caller a policy denies and whose SearchVectors fails a check that needs no table gets ValidationException, where it got AccessDeniedException.
  • dynamodb:Attributes carries no value on SearchVectors. A Deny on an attribute no longer refuses a search that projects it, a Deny gated on Null true refuses every search, an Allow gated on ForAllValues grants every search its Action covers, and a bare negated operator over the key matches every search.
  • With the extended grammar, the default, a Number in a condition on an inline filter attribute compares as the nearest binary64 value of each side: 9007199254740992 and 9007199254740993 are equal. The HASH equality on a Number still compares exactly, as on DynamoDB.
  • With the extended grammar, these SearchVectors requests that 1.0.0 served are refused as DynamoDB refuses them: an inline filter attribute whose name has a character outside [A-Za-z0-9_] or starts with a digit or _, written without ExpressionAttributeNames (cat-x, Catégorie, _cat, 9lives); whitespace other than space, tab, CR and LF between tokens (form feed, vertical tab, U+00A0, U+2003); a condition longer than 4096 bytes. Under off they are served as before.
  • Under every setting, a build without the feature included: an ExpressionAttributeValues key longer than 255 bytes is refused, and a malformed ProjectionExpression answers ahead of a missing table, a missing index and a SearchVector of the wrong dimension, as on DynamoDB, where 1.0.0 answered ResourceNotFoundException, the index error and the dimension error.
  • On MongoDB, Cassandra and PostgreSQL without pgvector, a caller a policy denies gets SearchVectors is not supported by this storage backend, where it got AccessDeniedException.
  • Under off, a search whose answer depends on the grammar, a Number equality on an inline filter attribute among them, reads the setting, and answers ServiceUnavailable when no read has answered and the read fails or does not end within two seconds.
  • A build of extenddb-server or extenddb-app without default features no longer turns on the engine's search-inequality-filters feature; the extenddb binary crate has no search-inequality-filters feature.
  • Under off, for an account a list leaves out, and in a build without the feature, a name written only inside parentheses in the condition counts as unused: Country = :c AND (#k) = :s answers Value provided in ExpressionAttributeNames unused in expressions: keys: {#k}, where 1.0.0 answered Invalid attribute: (#k), and (#h) = :c AND (Cat) = :s, with #h the HASH attribute, answers the same message for #h, where 1.0.0 answered SearchConditionExpression must have all HASH attributes in configured SearchSchema. With the extended grammar both return the items they select, as on DynamoDB.
  • A ConditionExpression or FilterExpression BETWEEN with Binary bounds names them as B: and base64 in its refusal, where it named them B:<binary>.
  • VectorSearch, the input of the storage trait's vector search, has a public field, item_filter, and SettingsStore has a method, get_setting_bounded, with a default. A backend outside this repository sets the field to None and serves the equality filters as before.

By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache License 2.0 and I agree to the Developer Certificate of
Origin (DCO). See CONTRIBUTING.md for details.

A SearchVectors condition beyond equality (a range, OR, NOT, IN, an
existence function) cannot be lowered to the equality pairs a vector
search takes today, and the service applies the condition before the
TopK cut, so the backend has to evaluate it.

VectorSearch gains item_filter, an optional VectorItemFilter that a
backend calls on each candidate before ranking it. SQLite calls it in
its candidate loop. PostgreSQL runs its statement with LIMIT NULL when a
filter is present, reads the rows in score order with the same tie
break, and keeps the first top_k that match. Every existing caller
passes None, and with None both backends run the statement and the loop
they ran before.

The trait lives in the storage crate so a backend evaluates a condition
without depending on the grammar that produced it.
For accounts the service enables, a SearchVectors condition takes the
comparators <>, <, <=, > and >=, BETWEEN, IN, OR, NOT, parentheses,
attribute_exists and attribute_not_exists, and more than one condition
on an attribute. The service parses it with the condition grammar it
shares with ConditionExpression, then applies its search rules: each
comparison, BETWEEN, IN and function is one condition, at most 50; IN
lists and BETWEEN bounds hold values only; nested paths and other
functions are refused. Once the index is known, it requires one
must-match = on the HASH attribute, allows ordering operators only on
Number attributes, and checks each value's type, in that order.

ExtendDB accepted only an AND of equalities.

The new search_filter module, behind the search-inequality-filters
feature, implements that grammar with its own lexer and parser, so a
syntax error can quote the offending token and its neighbours. Checks
run in the order the service applies them: size, syntax, redundant
parentheses, names and values, operand types, BETWEEN bounds, IN list
length, the 300 operator limit, the combined size, the search rules in
written order, and unused values. The parsed tree lowers to the existing
condition AST, so evaluation uses the FilterExpression semantics. The
module also parses the search_inequality_filters setting: off, all, or a
list of account IDs.

Unit tests cover the grammar, the rules, the schema checks and
evaluation. Their expected messages and results are predictions, not yet
measured against the live service.
The service parses a SearchVectors condition with the extended grammar:
comparators other than `=`, BETWEEN, IN, OR, NOT, parentheses and
functions.

SearchVectors parses the condition with the extended grammar when the
search_inequality_filters setting enables the caller, and otherwise runs
the equality-only validator as before. The setting is read on every
request from the settings store the server installs at startup, so a
change takes effect without a restart; an absent, unreadable or
malformed value enables no account. The HASH condition selects the
partition and the whole condition becomes the backend's item filter. The
parser takes the backend's vector search engine, which exists only after
the vector gate passed, so a backend without vector search refuses the
request before the grammar runs.

The search-inequality-filters feature is declared in the engine, server,
app and binary crates and is off by default. With it off, the module is
an uninhabited stub, the setting is not a known key, and SearchVectors
runs exactly as before.

Engine tests cover the setting's values, a failing store, and the filter
handed to the backend.
A vector search with a condition must rank only the items that satisfy
it, so the TopK cut applies after the filter.

Both backends gain a test-only search-inequality-filters feature. The
SQLite test and the PostgreSQL integration test parse conditions with
the extended grammar and search a table whose index has a HASH and a
Number inline filter: a range with TopK 2 returns the two nearest
matching items, not the two nearest, and the HASH value scopes the
search. The cases for a missing attribute under <> and NOT, and for 1E2
against 100, follow the FilterExpression semantics and are not yet
measured against the live service.

The PostgreSQL test uses one database pair, created on first use and
kept, and deletes its table when it passes.
The integration test turns the extended grammar on through the settings
API, restores the previous value afterwards, and skips when the target
answers an inequality search with the equality-only message. It covers
each comparator, ordering refused on String and Binary attributes, a
missing attribute, numbers compared as decimals, the HASH scope, the
filter applied before TopK, OR, NOT, IN and BETWEEN, the HASH rules, the
grammar rules, the schema checks in written order, and the 50 condition
limit. On a backend without vector search it checks that the backend's
refusal answers before the grammar runs.

It passed against local servers on SQLite and on PostgreSQL. The
expected responses are not yet measured against the live service.
The service checks ExpressionAttributeNames and
ExpressionAttributeValues once TopK and SearchVector are valid, before
it reads the projection or the search condition. An empty map is refused
with "... must not be empty", names first. Each name is checked for an
empty attribute name, then for a name of 65536 bytes or more, then each
key for being empty, longer than 255 bytes, or not a placeholder; a
too-long key reports its size in both maps. Names with neither a search
condition nor a projection, and values without a search condition, are
refused with "... can only be specified when using expressions". The
projection is read before the search condition. Once the condition
parses, a name that neither expression uses is refused with "Value
provided in ExpressionAttributeNames unused in expressions", ahead of
unused values and the index schema checks.

ExtendDB accepted an empty map and answered the next check, or 200. It
did not check the keys or the name values, accepted values and names
sent without an expression, never refused an unused name, and read the
projection after the search.

The checks now run in that order for both search condition grammars, in
a module of their own. The key messages differ from those of the other
operations, so the other operations keep the shared deserializers and
their messages.

Verified against live DynamoDB in eu-north-1, each request twice with
the same answer both times: 41 requests on check order (TopK, IndexName,
SearchVector and ReturnConsumedCapacity before an empty map; the empty
map before a dimension mismatch and a missing table; names before
values; the projection before the condition; unused names after a
condition syntax error and before unused values and the HASH check), and
the 22 map and expression rows of the SearchVectors parity catalog, 14
of them measured again with no empty map in the request. Unit tests pin
each message and order.
The service compares the numbers of a search condition as the nearest
IEEE 754 binary64 value of each side. Two Prices that differ only in the
last of 38 digits are equal, and so are 9007199254740992 and
9007199254740993, while 1000000000000000 and 1000000000000001 differ.
The BETWEEN check that the upper bound is not below the lower bound
stays exact.

ExtendDB compared them as exact decimals, so Price >
99999999999999999999999999999999999998 matched an item whose Price is
99999999999999999999999999999999999999, and live returned no item.

The condition evaluator takes a number precision. The search filter uses
binary64; condition, filter and key condition expressions keep exact
decimals.

Verified against live DynamoDB in eu-north-1 on 28 items in 14 pairs
that differ in the last significant digit (8, 15, 16, 17, 20 and 38
digits, negatives, 1E-10, 0.1, 1E+100): 165 requests over >, >=, <, <=,
=, <>, BETWEEN, IN, NOT and a value on the left, each sent twice with
the same answer. Binary64 on both sides agrees with all 151 result sets;
exact decimals disagree with 111, 16 significant digits with 14,
binary32 with
57. Unit tests replay the pairs.
The service answers the condition-limit shapes differently for an
account with the extended grammar: the 20th comparison is no fault of
its own, and the schema, HASH and unused-value checks answer instead.
The module expected the equality-only answers, so it failed 21 of 43
cases under the extended grammar, on the service and on ExtendDB alike.

The module now asks the target which grammar it serves, by sending h =
:v0 AND f1 <> :v1, which the equality-only grammar refuses with the
comparator message and the extended grammar answers. Each case then
asserts that grammar's answer. The inequality filter module gains the
expression map checks (empty maps, keys, name values, maps without their
expression, unused names, the projection read first) and the binary64
number comparison, and omits ExpressionAttributeValues when the
condition uses no value.

Verified against live DynamoDB in eu-north-1, each module twice:
condition limit 43 passed, inequality filters 21 passed and 1 skipped
(the backend-without-vectors case). On ExtendDB SQLite both modules pass
with the grammar on and off.
The service reads the projection before the search condition, counts a
name the projection uses as used, and refuses an unused name ahead of an
unused value under either grammar.

Unit tests drive the handler's check, the equality-only grammar and the
extended grammar's parse with the requests measured against live
DynamoDB in eu-north-1 (each twice): an undefined projection name ahead
of a condition syntax error, an unused name with only a projection, an
unused name ahead of an unused value, and a name used only by the
projection.
A Scan FilterExpression tells apart numbers that share a binary64 value:
Price > 99999999999999999999999999999999999998 matches Price
99999999999999999999999999999999999999, and Price > 9007199254740992
matches 9007199254740993. Only the SearchVectors inline filters compare
at binary64.

No test failed when evaluate_condition was switched to the binary64
mode, so a test now pins the exact comparison.

Verified against live DynamoDB in eu-north-1: both Scans twice, with the
same answer each time.
The service answers a search condition nested as deep as the 4096-byte
limit allows with an ordinary ValidationException: 4089 unclosed `(`
before `a = :v` give `Syntax error; token: "<EOF>", near: ":v"`, 818
nested `NOT(` give the operator count, and 1365 nested calls give the
function name error.

The extended grammar parsed with recursive descent, checked the tree
with recursive walks and dropped it with the recursive drop glue, all
before the 300-operator limit applied. About 1500 unclosed `(`
overflowed a 2 MiB tokio worker stack in a release server, and about 200
nested `NOT(` did in a debug server. A stack overflow aborts the
process, so one request stopped the server for every account.

The parser now keeps its open groups and open calls on explicit stacks,
the tree-building checks, the operator count and the combined size walk
the tree with their own stacks, and dropping a node or a call moves its
children to a heap stack. The tokens consumed and the token a syntax
error names are unchanged. Every phase that still recurses runs after
the operator limit, so it sees at most 300 levels.

Verified with new tests in the debug test profile: each nesting form at
and past the byte limit is rejected on a thread with a 64 KiB stack, and
the deepest accepted condition parses, evaluates and drops on a 2 MiB
stack, the stack of a tokio worker. Restoring the recursive parser, the
recursive walks or the recursive drop each aborts the test process with
a stack overflow. The expected answers were measured on the live
service, two requests each.
The service does not start a bare name with `_`. `Country = :us AND _Cat
= :v` answers `Invalid SearchConditionExpression: Syntax error; token:
"_", near: "AND _Cat"`: the `_` is a token of its own, and the near text
runs on to the token after it, so `__a = :v` gives near `__`. The same
holds for a name after `.`, a function name, and a name inside a call,
an IN list or a BETWEEN. An underscore inside or at the end of a name,
and in a `#name` or `:value` reference, is accepted.

The extended grammar's lexer started a name on a letter or `_`, so
`_Cat` lexed as one name and the request failed later with the search
schema message.

A name now starts on a letter only. A leading `_` becomes a one-byte
token that no rule takes, which the parser reports as the syntax error
at that byte.

Verified with a new test of 21 expressions measured on the live service,
two requests each, against a missing table and an existing vector table.
The service takes `( operand )` wherever an operand goes: `(a) = :v`, `a
= (:v)`, `NOT (a) = :v`, `a BETWEEN (:v) AND (:w)`, `a IN ((:v), (:w))`,
`size((a))` and `(attribute_exists(a))` all pass the expression checks.
No path step follows the `)`: `(a).b = :v` answers `Syntax error; token:
".", near: ").b"`. The `(` of a call or an IN list is not a group for
the redundant parentheses rule, so `attribute_exists((a))` and `a IN
((:v))` pass while `attribute_exists(((a)))` and `((a)) = :v` answer
`The expression has redundant parentheses;`.

The extended grammar took `(` only as the start of a group, so each of
these requests answered a syntax error, and the redundant parentheses
rule counted the `(` of a call or a list as a group.

An operand may now be a parenthesised operand. Where a condition starts,
a run of `(` opens a parenthesised operand when an operand and its `)`
follow, and groups otherwise; the parser decides from one attempt at the
operand, so a run costs at most two passes over it. The redundant
parentheses rule skips a `(` that follows a function name or IN.

Verified with new tests of 33 expressions measured on the live service,
two requests each, and with depth tests of 2000 `(` inside a BETWEEN
bound, an IN list and a call argument on a 64 KiB stack.
The service checks each function operand against the types the function
takes. size takes a string, binary, set, list or map and returns a
number, so `size(size(a)) = :w` answers `Incorrect operand type for
operator or function; operator or function: size, operand type: N`.
begins_with takes strings and binaries on either side, so
`begins_with(a, size(b))` and `begins_with(:w, a)` answer the same for
begins_with. attribute_type takes a type name as its second operand and
answers the operand type for anything else, a path included. Only
attribute_exists and attribute_not_exists require a path. A function
that passes, such as `size(:v) = :w` or `begins_with(:v, :v)`, then
meets the search rule that allows only the existence functions.

The extended grammar required a path as the first operand of every
function, so each of these requests answered `Operator or function
requires a document path`.

The tree-building check now applies the service's order: the operand
count, the place a function may stand, the operand types, the distinct
first operand, then the existence functions' path and the attribute type
name.

Verified with new tests of 32 expressions measured on the live service,
two requests each, and with depth tests of up to 681 nested size calls
inside a comparison, a BETWEEN bound, an IN list and begins_with.
The service compares BETWEEN bounds exactly, even though it evaluates an
inline filter in binary64. `Price BETWEEN :lo AND :hi` with `:lo =
9007199254740993` and `:hi = 9007199254740992` answers `The BETWEEN
operator requires upper bound to be greater than or equal to lower
bound`, as do 38-digit neighbours, 1.0000000000000001E+100 over 1E+100,
0.10000000000000001 over 0.1, 1.0000000000000001E-10 over 1E-10 and
-1E16 over -(1E16 + 1). `1.0` and `1`, and 2^53 and 2^53 + 1 in order,
pass.

ExtendDB already checks the bounds exactly, but no test held it: a bound
check switched to binary64 passed every test.

The new test sends those pairs, in the plain decimal form the engine
passes numbers in, and checks the measured messages.

Verified on the live service, two requests each, against a missing table
and an existing vector table; switching the bound check to binary64
fails the test.
The handler parsed the search condition with one of two grammars and
then resolved the scope with the matching schema check, inline. That
dispatch and the equality-only scope resolution now live in
search_vectors_condition.rs, a child module of the handler.

This is a pure move: the checks, their order and their messages are
unchanged. search_vectors.rs goes from 834 to 723 lines.

Verified: cargo test -p extenddb-engine --lib search_vectors, feature
off 19 passed, feature on 24 passed.
The extended SearchConditionExpression grammar is enabled per account by
the search_inequality_filters runtime setting. A fault in the service's
own configuration path is never answered as a caller error.

ExtendDB read the setting from the catalog on every SearchVectors
request that carried a condition, with no timeout, and treated a failed
read as "off". A transient catalog fault therefore answered an
inequality request with a non-retryable ValidationException. The store
sat in one process-wide slot: the last server to install one won, and a
poisoned lock read as "no store" without a log line.

Each server now installs its settings store against its own storage
engine. A read is kept for one second and shared by concurrent requests,
bounded at two seconds, and a failed or late read answers
ServiceUnavailableException, the classified error ExtendDB uses for
transient storage faults. A write through the management API drops the
kept reads, so the change applies at once; a write through the CLI
applies within the refresh interval. A malformed value is logged once
per change instead of once per request. A storage engine with no
installed store enables no account.

Verified: engine unit tests for each property (per-server stores, no
store, failed read, read past the timeout, refresh interval, one shared
read for 16 concurrent requests, management write); cargo test -p
extenddb-engine --lib search_vectors, feature on 33 passed, feature off
19 passed; clippy -D warnings on engine and server with the feature.
DynamoDB compares inline-filter strings and binary values exactly and
inline-filter numbers as binary64 in a SearchConditionExpression made of
equalities only. Measured on 2026-11-23, two runs: Price =
9007199254740993 matches a stored 9007199254740992, 1 matches
1.00000000000000000001, 0.3 does not match 0.30000000000000004; Cat =
"A", "a " and the decomposed form of a composed string each match only
themselves; the numeric HASH value selects its partition exactly.

For an account the extended grammar is enabled for, ExtendDB sent every
search condition to the backend as an item filter, including Country =
:c alone and Country = :c AND Cat = :s. On PostgreSQL that dropped the
SQL equality filter and the LIMIT, so the backend read and sorted the
whole partition for requests it had answered with a top-k query before
the setting was turned on.

A condition that the equality-only grammar also accepts, on distinct
attributes, with no number among its inline-filter values, now reaches
the backend as equality pairs with no item filter; the HASH value still
selects the partition. Any other condition, a number equality included,
goes to the item filter, which compares numbers as binary64 as the
service does. Accounts the setting leaves out are unchanged.

Verified: engine tests for each route (string and binary pairs with and
without a HASH element, the HASH equality alone, a number equality
matching its binary64 neighbour through the item filter, inequality, OR,
attribute_exists and IN, and the setting off); cargo test -p
extenddb-engine --lib search_vectors, feature on 38 passed, feature off
19 passed.
DynamoDB answers an empty ExpressionAttributeValues or
ExpressionAttributeNames with "<map> must not be empty" ahead of a
missing table and ahead of a SearchVector whose length does not match
the index. Measured on 2026-11-23, two runs each; with valid maps the
same requests answer ResourceNotFoundException and "Input search vector
dimension 2 does not match vector index dimension 4".

ExtendDB answers in that order, but only unit tests of the map checks
pinned it, and those cannot see where the handler runs them. Two handler
tests on a SQLite catalog now send each request and its valid-map
control.

The settings tests also gain a deadline of their own around the bounded
read and a store that answers after a delay, so concurrent readers
interleave; the equality-pair route no longer checks for a repeated
attribute, since repeated pairs combine with AND as the item filter
does.

Verified: cargo test -p extenddb-engine --lib search_vectors, feature on
40 passed, feature off 21 passed.
A SearchVectors condition that the backend evaluates on each decoded
item cuts top_k after the condition, so a search reads the score
ordering until top_k rows match. On PostgreSQL that search ran the
search statement with no limit: the server sorted the whole partition
with every row's item and embedding, sent all of it, and kept sending
after the search had its top_k rows. The connection stayed busy until
the last row was read, and a dropped request left the statement running
to the end.

The search now reads the ordering in pages. Each page is the ordering
after the last row of the page before, compared on the score and the
whole base key, with a limit, and carries only each row's score and
address, so the server runs a bounded top-N sort that may run in
parallel. Pages start at four times top_k (at least 64 rows) and grow
eight times per step to 65,536. The items of a page are read by address
1,024 at a time, in page order, and the search stops at the top_k-th
match. The embeddings of the kept rows are read last. Every statement
runs in one REPEATABLE READ READ ONLY transaction, so they read one
snapshot and the result is the one a single statement would give, ties
included. A search that is dropped closes its connection instead of
returning it to the pool, and sends pg_cancel_backend to the backend, so
the statement in flight stops.

Measured on pgvector pg16, one partition, 64 dimensions, a 2,000-byte
attribute per item, top_k 10, one pooled connection, ten searches in a
row (so work left on the connection counts), median of three interleaved
runs, before and after, at 100,000 rows:

- a condition that every row satisfies: 1,370 ms, 264 ms
- one that 1 percent of rows satisfy: 1,363 ms, 1,011 ms
- one that 0.1 percent satisfy: 2,067 ms, 2,376 ms
- one that no row satisfies: 9,731 ms, 12,895 ms

Sort spill for twelve searches went from 172 to 516 MB to at most 13 MB,
and the server's peak memory during a run from up to 786 MB to 261 MB.
At 10,000 rows the four cases take 236, 278, 977 and 1,035 ms before and
90, 486, 1,316 and 1,301 ms after. A search dropped after 5 ms or 60 ms
left no active statement at the first check, 1 ms later; before, the
statement ran for about 0.9 s at 100,000 rows. The result equals the
unfiltered ordering filtered and cut at top_k, ids and scores, for top_k
1, 10, 50, 100 and 1,000 at 10,000 and 100,000 rows with groups of seven
equal scores.
The PostgreSQL condition tests used distinct scores and one HASH value,
and kept their database pair between runs. The search now reads the
ordering in pages inside one snapshot, and no test data reached a second
page or a tie.

The fixture now creates a database pair per test and drops both when the
test ends, also when the setup or the test body panics. The condition
test data has two items with one vector, and a second HASH value whose
items are nearer than every item of the first and match its conditions.
A second file loads 600 items whose scores tie in groups of seven, so a
group straddles both page boundaries a top_k of 10 reaches, and checks
conditions whose matches sit in those groups, in every page and in none
against the backend's own unfiltered ordering, ids and scores. Another
test deletes the rows the second page reads while the search runs, and
checks that the search answers from its first snapshot and a later
search sees the delete.
The service checks ExpressionAttributeNames and
ExpressionAttributeValues before it parses the search condition, under
either grammar. Measured in eu-north-1, each request twice: keys of 254
and 255 bytes in either map answer 200, and a 256-byte key answers
"contains a key that is too long; size of key: 256". The value-shape
requests of the condition limit module answer "Multiple attribute names
used in one condition" under the extended grammar.

The inequality module wrote the search_inequality_filters setting for
the whole server while it ran and wrote "off" back when the setting had
been absent. A condition limit run started 0.8 s earlier on the same
server got 17 failures. It skipped, rather than failed, when the server
took the setting and still served the equality grammar; neither module
checked the grammar against the setting; the inequality module ignored
EXTENDDB_EXPECT_VECTORS; its backend refusal test could not fail; and
the map tests skipped on every build without the feature.

The modules now share tests/search_vectors_wire.py. They read the
setting and never write it; devtools/run-tests writes it before any
suite starts from EXTENDDB_TEST_SEARCH_INEQUALITY_FILTERS and stops when
the server refuses it. Against ExtendDB each module fails when the probe
gets the other grammar's answer. The map checks moved to
test_search_vectors_expression_maps.py, which uses conditions both
grammars accept and pins the 255-byte key limit on both sides. The
backend refusal test asserts the CreateTable and SearchVectors refusals
with a condition neither grammar parses. DeleteTable answers are
asserted. The value-shape test asserts the measured extended answer.
devtools/provision-test-credentials exports EXTENDDB_TEST_ACCOUNT_ID for
an account-list setting. A --filter that selects no test of the CLI
lifecycle or backup store wire block no longer fails the run.

test_authz_search_vectors_index.py takes the EXTENDDB_EXPECT_VECTORS
helper from search_vectors_wire, where it now lives.

Verified on SQLite and PostgreSQL builds with the feature, setting
absent and all, a SQLite build without it, MongoDB and Cassandra, and
twice against the live service in eu-north-1, with a negative control
per new assertion.
No workflow built the search-inequality-filters feature. Its unit tests
are compiled only with it, and the inequality wire module skipped on
every CI server, so neither ran in CI and clippy never saw the feature's
code.

search-inequality-filters.yml runs clippy 1.97.0 on the workspace with
the feature and on the SQLite-only binary with it, an MSRV 1.88 build,
the unit tests of core, engine, server and the SQLite store with it, the
PostgreSQL storage tests with it against pgvector, and the vector wire
tests through devtools/run-tests against SQLite and PostgreSQL servers
built with it, with the setting at all and EXTENDDB_EXPECT_VECTORS=1.
The CLI catalog migration file, which builds its own catalogs, is left
out of that run. The PostgreSQL and SQLite pytest steps of
integration.yml set EXTENDDB_EXPECT_VECTORS=1, so the SearchVectors
modules fail there rather than skip when vector indexes are refused.

Checked with actionlint and shellcheck and the repository's
pinned-action check; the commands of each job ran locally.
A dropped filtered vector search closed its connection and sent
pg_cancel_backend for the backend process id it read at BEGIN. Behind a
transaction-pooling proxy that returns a backend to its pool when the
client disconnects, the backend can serve another client's transaction
by the time the cancel arrives. Measured with a pgcat 1.2.0 proxy in
transaction mode in front of PostgreSQL 16: in three of three runs the
next client received the same backend and its statement failed with
"canceling statement due to user request", and in three further runs the
cancel query landed on that backend and cancelled itself. Directly and
through pgbouncer 1.26.1 in transaction mode the backend was not reused.

The search now records the backend process id together with the start of
its transaction (now(), which pg_stat_activity reports as xact_start),
and the cancel signals the backend only while pg_stat_activity shows it
in that transaction. A process id that was reused, or a backend that
serves another transaction, matches no row and receives nothing.

Two new tests run two transactions on one backend, as a pooling proxy
does: a cancel for the first transaction leaves the second one's
pg_sleep running, and a cancel for the second stops it. The existing
drop test still sees the dropped search's statement stop. With the
proxy, the guarded cancel spared the next client in two of two runs;
directly and through pgbouncer it still cancelled the dropped search's
running statement in four of four runs.
A SearchVectors request with a condition reads the
search_inequality_filters setting from the catalog, kept for one second,
with one request reading at a time. A read that took longer than two
seconds was dropped by the engine, and the request answered
ServiceUnavailableException. On PostgreSQL the dropped read kept its
statement and its catalog connection waiting in the server. With the
settings table locked for 80 seconds, a new read was sent about every
three seconds, each holding another catalog connection, until all 20
were held at 45 seconds. From then searches answered InternalServerError
as well as ServiceUnavailableException, and DescribeTable, which does
not read the setting, answered InternalServerError after 30 seconds.

The read now runs in its own task. A request that stops waiting for it
leaves the task running, and the next request waits on the same read
instead of sending another, so a catalog that does not answer holds at
most one connection for the setting. A read sent before a change through
the management API is left to end and a new read is sent. A failed or
slow read still answers ServiceUnavailableException.

Unit tests pin one read sent over 20 refresh intervals while it never
ends, the late answer used by the next request, and a change applied
while an earlier read has not ended.

On a release PostgreSQL server with the settings table locked for 80
seconds, 8 searching clients and one DescribeTable client, three runs:
at most one connection waited on the lock apart from the server's own 30
second setting pollers, every search answered
ServiceUnavailableException within 1.1 s, and DescribeTable answered 200
on every call (346 to 370 calls, at most 125 ms). Before the change, two
runs, 20 connections waited from 45 s and DescribeTable answered
InternalServerError after 30 s.
The PostgreSQL settings store read a setting with one statement that had
no server-side bound. Behind a lock on the settings table the statement
waited until the lock was released, and a caller that stopped waiting
left it waiting in the server with its catalog connection.

A settings read now runs in a read transaction that sets lock_timeout to
1 s and statement_timeout to 1.5 s for that transaction only, so a read
behind a held lock fails in the server and gives its connection back,
also when the caller has dropped it.

A test locks the settings table from a second session, checks that a
read fails within 3 s, that reads dropped after 100 ms leave no
statement waiting on the lock 3 s later, and that a read after the
unlock answers the stored value.

On a release server with the settings table locked for 80 seconds, the
server's 30 second pollers of log_level, sqlx_log_level and
throttling_enabled, which read through the same store, held at most five
waiting connections for under a second, where before the change their
reads waited for the whole lock.
The setting is looked up in a process-wide server list and kept per
server behind standard mutexes, and every lock recovers from poisoning.
No test covered that: answering Off when the server list is poisoned
passed every test.

A test poisons the server list, the server's kept read and its change
count with a thread that panics while holding each, then checks that the
setting is read once, the kept read is used, and a change through the
management API applies.
Under the extended grammar the service compares the two BETWEEN bounds
exactly. A pair that is one binary64 value but out of order exactly,
such as 9007199254740993 and 9007199254740992, gets the upper bound
message, with each number shown in plain decimal. 1.0 and 1, and 2^53
and 2^53+1 in order, are accepted.

ExtendDB answers the same, but no wire test sent such a pair, so a
server that compared the bounds as binary64 passed every wire module.

The inequality module now sends the six out-of-order pairs and the two
in-order ones. Measured on the live service in eu-north-1 on 2026-11-23,
two requests each. The module passes against the live service, and
against SQLite and PostgreSQL servers with the setting at all; with the
bound check at binary64 the new test fails.
The service checks ExpressionAttributeValues and
ExpressionAttributeNames before it looks up the table: an empty map sent
to a missing table answers "<map> must not be empty", and the same
request with a valid map answers ResourceNotFoundException.

The engine tests pinned this order, and no wire test did.

The expression maps module now sends both empty maps and a valid map to
a missing table. Measured on the live service in eu-north-1 on
2026-11-23, two requests each. With the table lookup moved ahead of the
map checks the new test fails.
Under the extended grammar the service refuses a search condition of
1500 or 4080 open parentheses, or 818 unclosed "NOT (", with the syntax
error near the last operand, and 818 closed "NOT(" with the operator
count message. It goes on answering.

A server built before the parser stopped recursing aborted on 1500 open
parentheses, and every account lost service. Unit tests pinned the
parse; no wire test sent such a condition to a running server.

The new module sends the four conditions to a vector table, asserts the
answer under the extended grammar and a refusal under the equality-only
grammar, and after each one sends a valid search and, against ExtendDB,
reads /health. Measured on the live service in eu-north-1 on 2026-11-23,
two requests each, on an existing and a missing table. A server built
from before the change aborts and the test fails.
…sertSqlSafe

sqlx 0.9 takes a SQL string that is not a &'static str only through
sqlx::AssertSqlSafe. Main moved to sqlx 0.9.1, and the filtered
SearchVectors path built its page, item and embedding statements at run
time and passed them as &str, so storage-postgres did not compile. The
page statement also passed a borrowed &'q str into the query, which
sqlx 0.9 rejects as borrowed data escaping the method.

Each of these calls now wraps its SQL, with no change to the SQL text or
the bound values. In vector_search_filtered.rs the embedding statement
is used once, so the query takes the owned String. The page statements
are reused on every page and the item statement on every batch, so the
query copies them. The two pg_sleep statements in the vector_search_scan
tests copy their String. The test fixtures create and drop their
databases and delete rows of a vector table through the owned format!
result. The SQL names are a UUID the test generates, the database names
the fixture creates, and the vector table name the server reports.

Verified: clippy 1.97.0 --workspace --all-targets -D warnings is clean.
@LeeroyHannigan
LeeroyHannigan added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit 2a820be Nov 26, 2026
84 of 86 checks passed
@LeeroyHannigan
LeeroyHannigan deleted the feat/search-inequality-filters branch November 26, 2026 18:42
robinnsc added a commit that referenced this pull request Nov 27, 2026
Moves the workspace version from 1.0.0 to 1.1.0 on every surface that
carries it: the root Cargo.toml version and its 13 exact pins, the 15
workspace entries in Cargo.lock (no third-party entry changes),
packaging/npm/package.json (the version and the five platform pins),
the four license-notice files (regenerated with cargo-about 0.9.0), and
the sample `extenddb version` and `serve` output in
docs/getting-started.md and docs/manuals/04-quickstart-setup-guide.md.

This is a minor release. Since v1.0.0, main has three features (#468,
#1009, #1449) and changes that make ExtendDB answer as DynamoDB does, which
docs/versioning.md ships in a minor release. It adds no catalog
migration (RELEASED_THROUGH stays 12, the last id), no configuration
key and no backup format version.

Upgrade manual, Behavior Changes by Release: v1.1.0 entries for #468
(AT_TIMESTAMP, and the GetShardIterator answers it changes), #486,
#503, #544, #567, #765 and #774, #588, #596, #690, #963, #1144, #1173,
#1194, #1375 and #1522, next to the existing entries for #398, #526,
#1166, #1449 and #1523. The #526 entry now gives the old
TransactWriteItems mismatch message, the #1523 heading takes the
v1.1.0: prefix, and the entries are in PR order. Current Status, the General
Upgrade Procedure and the Rollback Procedure cover 1.0.0 to 1.1.0: no
migrate step, the #1166 checks before a PostgreSQL upgrade, and a
rollback runs the 1.0.0 binary on the same catalog, with the two
limits the manual names (#526 tokens, and 1.0.0's catalog-check
--fix). The rollback note of the KEK-file switch says that 1.0.0
serves a switched catalog.

docs/manuals/11-deployment-guide.md: a sentence about the release
before the one that carries #398 is gone.
@robinnsc robinnsc mentioned this pull request Nov 27, 2026
6 of 8 tasks
robinnsc added a commit that referenced this pull request Nov 27, 2026
Moves the workspace version from 1.0.0 to 1.1.0 on every surface that
carries it: the root Cargo.toml version and its 13 exact pins, the 15
workspace entries in Cargo.lock (no third-party entry changes),
packaging/npm/package.json (the version and the five platform pins),
the four license-notice files (regenerated with cargo-about 0.9.0), and
the sample `extenddb version` and `serve` output in
docs/getting-started.md and docs/manuals/04-quickstart-setup-guide.md.

This is a minor release. Since v1.0.0, main has three features (#468,
#1009, #1449) and changes that make ExtendDB answer as DynamoDB does, which
docs/versioning.md ships in a minor release. It adds no catalog
migration (RELEASED_THROUGH stays 12, the last id), no configuration
key and no backup format version.

Upgrade manual, Behavior Changes by Release: v1.1.0 entries for #468
(AT_TIMESTAMP, and the GetShardIterator answers it changes), #486,
#503, #544, #567, #765 and #774, #588, #596, #690, #963, #1144, #1173,
#1194, #1375 and #1522, next to the existing entries for #398, #526,
#1166, #1449 and #1523. The #526 entry now gives the old
TransactWriteItems mismatch message, the #1523 heading takes the
v1.1.0: prefix, and the entries are in PR order. Current Status, the General
Upgrade Procedure and the Rollback Procedure cover 1.0.0 to 1.1.0: no
migrate step, the #1166 checks before a PostgreSQL upgrade, and a
rollback runs the 1.0.0 binary on the same catalog, with the two
limits the manual names (#526 tokens, and 1.0.0's catalog-check
--fix). The rollback note of the KEK-file switch says that 1.0.0
serves a switched catalog.

docs/manuals/11-deployment-guide.md: a sentence about the release
before the one that carries #398 is gone.

docs/troubleshooting.md: the bus error entry names 1.0.0 as the release
that has the bug, so its line carries a version-literal-ok marker.
LeeroyHannigan added a commit that referenced this pull request Nov 27, 2026
* chore(release): bump version to 1.1.0

Moves the workspace version from 1.0.0 to 1.1.0 on every surface that
carries it: the root Cargo.toml version and its 13 exact pins, the 15
workspace entries in Cargo.lock (no third-party entry changes),
packaging/npm/package.json (the version and the five platform pins),
the four license-notice files (regenerated with cargo-about 0.9.0), and
the sample `extenddb version` and `serve` output in
docs/getting-started.md and docs/manuals/04-quickstart-setup-guide.md.

This is a minor release. Since v1.0.0, main has three features (#468,
#1009, #1449) and changes that make ExtendDB answer as DynamoDB does, which
docs/versioning.md ships in a minor release. It adds no catalog
migration (RELEASED_THROUGH stays 12, the last id), no configuration
key and no backup format version.

Upgrade manual, Behavior Changes by Release: v1.1.0 entries for #468
(AT_TIMESTAMP, and the GetShardIterator answers it changes), #486,
#503, #544, #567, #765 and #774, #588, #596, #690, #963, #1144, #1173,
#1194, #1375 and #1522, next to the existing entries for #398, #526,
#1166, #1449 and #1523. The #526 entry now gives the old
TransactWriteItems mismatch message, the #1523 heading takes the
v1.1.0: prefix, and the entries are in PR order. Current Status, the General
Upgrade Procedure and the Rollback Procedure cover 1.0.0 to 1.1.0: no
migrate step, the #1166 checks before a PostgreSQL upgrade, and a
rollback runs the 1.0.0 binary on the same catalog, with the two
limits the manual names (#526 tokens, and 1.0.0's catalog-check
--fix). The rollback note of the KEK-file switch says that 1.0.0
serves a switched catalog.

docs/manuals/11-deployment-guide.md: a sentence about the release
before the one that carries #398 is gone.

docs/troubleshooting.md: the bus error entry names 1.0.0 as the release
that has the bug, so its line carries a version-literal-ok marker.

* docs(upgrade): add the v1.1.0 entry of #1290, put #1349's in order

#1290 merged after this branch was rebased. It changes the answer to a
request with no Authorization header, so it gets a v1.1.0 entry. The
merge of main put the #1349 entry after the #1523 entry. It moves to
the place of its number, beside the new #1290 entry.

---------

Co-authored-by: Lee Hannigan <29015211+LeeroyHannigan@users.noreply.github.com>
annguy3n added a commit to annguy3n/extenddb that referenced this pull request Nov 30, 2026
Resolve the Cargo.toml and Cargo.lock merge conflicts with main (v1.1.0) and
adapt the Cloud Bigtable storage backend to upstream changes:

- Align workspace Cargo.toml and Cargo.lock with ExtendDB v1.1.0 (ExtendDB#1514), MSRV
  1.94.0 and sqlx 0.9.1 (ExtendDB#1166), and extenddb-server default-features = false
  (ExtendDB#1449), bumping extenddb-storage-bigtable to =1.1.0.
- Adapt AuthorizationStore::fetch_session_data (ExtendDB#1523) to look up role session
  policy, tags, and RFC 3339 created_at in O(1) by access_key_id via
  iam_session_ak:<access_key_id> -> iam_session:<session_token> without
  re-checking session expiry, with symmetric 4 KiB row-key and non-empty token
  guards across fetch_session_data and lookup_credential.
- Decide StreamSpecification transitions in BigtableEngine::update_table ahead
  of companion table fields and GSI updates (ExtendDB#963) so a refused disable/enable
  writes no other table member while still closing any open shards left behind
  by a prior disable.
- Update docs/bigtable-setup.md for Rust 1.94.0 and the exact v1.1.0 extenddb
  version output.
- Add unit and live cbtemulator integration tests covering
  session_data_conformance::run, expired/deleted/oversized session-data and
  credential lookups, write_bootstrap_rows admin environment-variable
  combinations and idempotent re-runs (ExtendDB#1349), ClientRequestToken NUL/backslash/
  UTF-8 escaped stored tokens (ExtendDB#1375), and refused stream disable/enable
  preceding companion edits (ExtendDB#963).
annguy3n added a commit to annguy3n/extenddb that referenced this pull request Nov 30, 2026
Merge upstream main (ExtendDB v1.1.0) into rfc/bigtable-backend and
reverse-sync docs/rfcs/0000-bigtable-backend.md with the v1.1.0 trait
surface and conformance coverage:

- Update ExtendDB binary version literals to v1.1.0 (ExtendDB#1514).
- Document O(1) access-key-indexed AuthorizationStore::fetch_session_data
  (including expired sessions), symmetric 4 KiB key-length bounds, and
  session_data_conformance::run (ExtendDB#1523).
- Document escaped ClientRequestToken stored tokens (ExtendDB#1375), pre-companion
  StreamSpecification refusal in TableEngine::update_table (ExtendDB#963), default
  SettingsStore::get_setting_bounded (ExtendDB#1449), and write_bootstrap_rows admin
  environment-variable handling (ExtendDB#1349).
LeeroyHannigan added a commit that referenced this pull request Dec 3, 2026
Main is at c8e66fb. This branch last had main at 80490c6. Since
then, 34 PRs merged into main, #1482 among them, which fixes the
WebAssembly build.

Two files conflicted:

- crates/engine/src/partiql/test_context.rs: main builds context()
  through crate::test_context::context_on (#1449), and this branch
  makes the old function pub(crate) for the missing-table test of
  query.rs. The merge takes the file of main and makes context
  pub(crate).
- docs/manuals/07-upgrade-manual.md: main added two v1.2.0 entries at
  the top of Behavior Changes by Release, where this branch added its
  v1.1.0 entry. The merge keeps the entries of main first, then the
  entry of this branch.

#1449 moved check_expression_size from
crates/engine/src/expression_helpers.rs to extenddb_core::expression,
where crates/engine/src/expression_helpers.rs imports it privately. So
crates/engine/src/query.rs now imports it from extenddb_core::expression.
Without that change the engine does not build (E0603). Git merged
expression_helpers.rs, partiql/mod.rs and query.rs with no other
conflict.
LeeroyHannigan added a commit that referenced this pull request Dec 3, 2026
Main is at c8e66fb. This branch last had main at 3534c9e. Since
then, 42 PRs merged into main, #1482 among them, which fixes the
WebAssembly build.

Seven files conflicted. The merge keeps both sides in each:

- crates/core/src/settings_keys.rs: #1449 adds the
  search_inequality_filters keys where this branch adds the GSI phase
  hold key. Both blocks stay, the hold first.
- crates/app/src/cmd_settings.rs: #1449 imports server_setting_default
  and this branch imports writable_key_validator from the same module.
  The import names both.
- crates/server/src/management/ops_settings.rs: #1449 adds the
  search_tests module where this branch adds its tests module. Both
  stay.
- crates/storage-mongodb/src/lib.rs: #486 adds mod error_class where
  this branch adds its two GSI modules. All three stay.
- crates/storage-postgres/src/delete_table.rs: #1411 refuses a table
  that is already DELETING before the indexes are read, where this
  branch built its description with the backfill set. The merge keeps
  the refusal of #1411 and reads the backfill set after it, before the
  index rows, as this branch does.
- crates/storage-sqlite/src/delete_table.rs: the same change of #1411.
  The second hunk keeps the backfill set before the index rows and the
  sqlx::AssertSqlSafe query of #1166.
- crates/storage-sqlite/src/table_helpers.rs: the backfill set before
  the catalog rows, and the sqlx::AssertSqlSafe query of #1166.
LeeroyHannigan added a commit that referenced this pull request Dec 3, 2026
Main at c057660. Three files conflicted.

crates/engine/src/partiql/test_context.rs: main (#1449) builds context
from crate::test_context. The merge takes the body of main and keeps
pub(crate) on context and block_on, which the table name length tests
call.

crates/engine/src/backup_requests.rs: main (#1137) moved
validate_name_member to extenddb_core::validation and kept a private
table_name_bounds. This branch moved table_name_bounds to
extenddb_core::validation::table_name_length. The merge keeps both
moves, so the file imports both functions and defines neither.

README.md: main (#1521) moved the WebAssembly section to
docs/webassembly.md. The merge takes the README.md of main. The README
changes of this branch go to docs/webassembly.md. They change the text
and the table of the checks that the server makes and this build does
not.

Main changed five other files of this branch. Git merged each change
of main beside the lines of this branch.

- crates/core/src/error/messages.rs: a message key.
- crates/engine/src/partiql/mod.rs: request_checks made pub(crate).
- crates/engine/src/transact_write_items.rs: the token comment and the
  stored token.
- crates/wasm-adapter/parity/corpus.json: corpus cases.
- docs/manuals/10-security-model.md: the authentication steps and the
  SearchVectors rows.
LeeroyHannigan added a commit that referenced this pull request Dec 3, 2026
Main is at c057660, 35 commits after the last merge (80490c6).
Three files conflicted.

crates/engine/src/expression_helpers.rs: #1449 moved
check_expression_size from this file to
crates/core/src/expression/kind.rs. This branch adds
check_expression_size_with, which takes the length suffix from the
caller, and check_expression_size calls it. The merge puts
check_expression_size_with in kind.rs beside check_expression_size,
which now calls it, and exports it from extenddb_core::expression. The
engine copies of both functions go, so the size check and its message
stay in one place. The import list is the list of this branch with the
two size checks added.

crates/core/src/expression/mod.rs: in the module list, #1449 adds
search_filter and search_params, and this branch adds semantics. The
merge keeps all three in name order.

docs/differences-from-dynamodb.md: this branch adds the row on a table
ARN in TableName, and #1411 adds two rows on a DELETING table at the
same place. The merge keeps the three rows.

Git merged 13 other files that both sides change, with no overlap. In
crates/engine/src/query.rs, #481 adds the key size check and moves the
Select index check after the ExclusiveStartKey checks. Both checks come
after the request-stage checks and the table lookup of this branch. In
core, the other files are crates/core/src/expression/evaluator.rs and
its tests, and crates/core/src/validation/mod.rs. In the engine, they
are crates/engine/src/lib.rs, crates/engine/src/partiql/mod.rs and the
two transaction files. In the storage crates, they are
crates/storage-cassandra/src/backup_engine.rs,
crates/storage-mongodb/src/table_engine.rs, the ddl.rs files of the
PostgreSQL and SQLite crates, and
crates/storage-sqlite/src/data/query_scan.rs.
LeeroyHannigan added a commit that referenced this pull request Dec 3, 2026
Main is at db8a90d. This branch last had main at 3534c9e (#1009).
Since then, 44 commits merged into main. Among them, #1514 released
v1.1.0 without this branch, and #1166 moved to sqlx 0.9.1.

Four files conflicted:

- crates/storage/src/lib.rs: #1449 exports VectorItemFilter beside the
  transact exports that this branch extends. The merge keeps both.
- crates/storage-mongodb/src/data_engine_live_tests.rs: #1446 declares
  its delete_table module where this branch declares token. The merge
  keeps both, main's first.
- crates/storage-postgres/tests/twi_conflict.rs: #1166 passes the SQL of
  the deadlock test through sqlx::AssertSqlSafe, and this branch takes
  the outside transaction from outside_transaction. The merge keeps the
  helper and the wrapper.
- docs/manuals/07-upgrade-manual.md: #1514 moved and rewrote the v1.1.0
  ClientRequestToken entry of #526. This branch changed the Cassandra
  sentence of the old copy. The merge keeps the entry as main has it.
  The text of this branch is now a v1.2.0 entry after the v1.2.0
  entries of main, because v1.1.0 shipped without this change.

sqlx 0.9 takes SQL that is not a &'static str only in
sqlx::AssertSqlSafe (#1166). The merge passes the SQL of the 11 queries
that this branch adds to twi_conflict.rs in it. The SQL text does not
change.

Git merged these files, which both sides change, at other lines:

- crates/core/src/error/mod.rs and crates/core/src/validation/mod.rs
- crates/engine/src/transact_write_helpers.rs and
  crates/storage/src/transact.rs
- tx_helpers.rs of PostgreSQL and SQLite, and
  crates/storage-postgres/src/data/update_item.rs
- the Cassandra direct_integration.rs and
  docs/differences-from-dynamodb.md

Since #1375, the engine stores a ClientRequestToken with each backslash
doubled and each U+0000 written \0 before a backend sees it. The token
code of this branch uses that stored form, as it used the token before.
LeeroyHannigan added a commit that referenced this pull request Dec 3, 2026
Main is at db8a90d. This branch last had main at 14ade59 (#864).
Since then, 35 commits merged into main. Among them, #1514 released
v1.1.0 without this branch, #1166 moved to sqlx 0.9.1, and #1449 added
the SearchVectors inequality filters.

Four files conflicted:

- crates/storage-postgres/src/vector_search.rs: #1166 passes the search
  statement through sqlx::AssertSqlSafe, and #1449 moves the vector
  attribute of a hit into hit(). This branch decodes the stored item
  through json_to_item. The merge keeps the wrapper and hit() of main
  and the decode of this branch.
- docs/adr/README.md: #1449 adds ADR-0031, the search condition grammar,
  where this branch lists its own ADR-0031. The ADR of this branch is
  now ADR-0032, the next number that no ADR on main and no open PR uses.
- docs/getting-started.md and docs/manuals/04-quickstart-setup-guide.md:
  #1514 shows version 1.1.0 in the sample output, and this branch shows
  catalog migration 13. The merge shows both.

The upgrade manual merged with no conflict, but the U+0000 entry of this
branch was a v1.1.0 entry. It is now a v1.2.0 entry after the v1.2.0
entries of main, because v1.1.0 shipped without this change. The
sentence that links to the entry names 1.2.0. It also adds 1.1.0 to the
releases whose deployments run extenddb migrate --yes once for
migration 13.

sqlx 0.9 takes SQL that is not a &'static str only in
sqlx::AssertSqlSafe (#1166). The merge passes the SQL of the 18 queries
that this branch adds in migration 13 and in its PostgreSQL tests in it.
The SQL text does not change. m0013_tests.rs runs the migration files
with raw_sql(*text), as the runner of main does.

Git merged the other files that both sides change at other lines. Main
adds no catalog migration, so migration 13 keeps its number.
LeeroyHannigan added a commit that referenced this pull request Dec 3, 2026
A SearchVectors request whose condition the equality filters cannot
express takes the filtered path of #1449. That path bound each equality
filter with the name and the JSON text that the request gives. It also
decoded each candidate item from item_data with serde. This branch
stores the strings of item_data through the escape, so the path read
the stored form. A filter value that holds U+0000 failed the jsonb
cast, and the condition read the escaped strings.

The search now builds the stored form of the equality filters once, for
the filtered path and the other path. The filtered path decodes each
candidate through json_to_item before it evaluates the condition, as
the other path decodes each hit.

a_filtered_vector_search_reads_control_characters_as_written in
crates/storage-postgres/tests/catalog_nul_index_writes.rs searches with
an equality filter on an inline filter attribute and with a condition.
The names and the values hold U+0000 and U+0001. The test checks that
the search returns the one item that matches both, as PutItem wrote it.
With the filters bound as the request gives them, the search fails with
SQLSTATE 22P05 (unsupported Unicode escape sequence). With the items
decoded by serde, it returns no item. The new helper vector_table builds
the table of this test and of a_vector_index_keeps_its_attribute_names.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants