pgcel
pgcel · Evaluate Common Expression Language programs against JSON values
Overview
PostgreSQL · 14, 15, 16, 17
Usage
Sources:
pgcel stores CEL expression source in the celprogram type and evaluates it against a JSONB context. Use it for reusable predicates or calculations inside SQL. The implementation registers shared memory during initialization, so preload the library and restart before use.
Core Workflow
Operational Boundaries
cel_compile validates source, cel_eval requires a boolean result, and cel_eval_json returns other results as JSONB. The input object is available as ctx; invalid expressions, missing values or incompatible result types can raise errors. PostgreSQL build features cover 14–17. The control file is non-relocatable and sets superuser=false; normal database/object privileges still apply. pgcel.program_cache_size defaults to 1024 compiled programs per backend and accepts 1–65536. Shared memory holds only validation hashes, not executable programs; every backend compiles its own executable. Size connection pools and caches accordingly. This early release is not a replacement for PostgreSQL role privileges or RLS.