pub fn optimize(plan: SqlPlan, catalog: &dyn SqlCatalog) -> SqlPlanExpand description
If a Scan has a single equality filter on the collection’s primary key, convert it to a PointGet.
The primary key is resolved from the catalog rather than assumed to be the
conventional id / document_id / key: a collection created without an
explicit PRIMARY KEY gets an auto-generated _rowid key, so a filter on a
regular id column is NOT a point lookup and must stay a scan (routing it
to PointGet would resolve a surrogate for the wrong key and return zero
rows). When the catalog cannot resolve a primary key (unknown collection),
fall back to the legacy convention so nothing regresses.