Expand description
objectiveai db query — read-only SQL executor.
Wraps the user’s single statement in a short-lived read-only
transaction. When a timeout is provided, server-side
statement_timeout and lock_timeout are set to its budget —
enforcement is postgres’s alone; there is no client-side timer.
When the server cancels (SQLSTATE 57014) the error maps to
Error::QueryTimeout and the transaction unwinds cleanly.
Without a timeout the query runs uncapped.
Each result cell is decoded to a serde_json::Value by
[pg_value_to_json], which dispatches on
pg_type.typname. Common Postgres types (text family,
integer family, float family, bool, uuid, timestamps, dates,
json/jsonb, bytea, inet/cidr, numeric) get a typed decode;
arrays of those common element types recurse; anything else
falls back to the text representation if it’s available, or
a <unsupported $TYPE> placeholder.