Skip to main content

query_rows

Function query_rows 

Source
pub fn query_rows(rows: Vec<Value>, nql: &str) -> Result<Vec<Value>>
Expand description

Run a query’s WHERE / ORDER BY / OFFSET / LIMIT against rows ALREADY IN HAND, rather than against stored documents.

This is what makes pg_catalog and information_schema real queryable tables instead of pattern-matched query strings. A catalogue row is synthesised from the live database, never stored — but psql filters and orders it with ordinary SQL, so it needs the ordinary predicate surface.

The alternative was to recognise psql’s exact query text and answer it from a fixed table. That breaks SILENTLY the moment psql changes its query, and an empty table list is indistinguishable from “this database has no tables” — the same class of confidently-wrong answer as everything else this engine has had to fix. So the predicate engine is REUSED here rather than a second, poorer copy being written: one eval_pred_with, one sort_by_keys, one paginate, already tested.

Clauses that only mean something against the log — AS OF, VALID AS OF, TRACE, TRAVERSE, SEARCH, and aggregates — are REFUSED by name. A catalogue has no history and no causal edges; silently ignoring the clause would answer a time-travel question with present-day rows.