eql
eql · Encrypt Query Language provides PostgreSQL types, functions, operators, and index support for searchable encrypted data.
Overview
PostgreSQL · 14, 15, 16, 17
Usage
Sources:
eql (packaged as cipherstash@eql) provides PostgreSQL types, functions, operators, and index configuration for searchable encrypted data. The cataloged package version is 2.2.1 and uses the eql_v2 API. EQL supplies the database-side representation and query surface; CipherStash Proxy or Protect.js must encrypt and decrypt values outside PostgreSQL.
Core Workflow
Generate and apply the pinned dbdev migration, then confirm the installed EQL API version:
Define an encrypted column with the persistent public type, register its plaintext type, and optionally add a searchable index configuration:
Write and query this column through a configured CipherStash client. Do not insert plaintext directly into public.eql_v2_encrypted and expect EQL to encrypt it.
Important Objects
public.eql_v2_encryptedis the encrypted column type, backed by validatedjsonbdata.public.eql_v2_configurationstores searchable-encryption configuration;public.eql_v2_configuration_stateis its state type.- The
eql_v2schema contains the functions and operators used to configure and query encrypted data. eql_v2.add_column(...)registers an encrypted column and its logical plaintext type.eql_v2.add_search_config(...)adds a search configuration such as a unique/equality index.eql_v2.version()reports the installed API version.
Privileges, Upgrades, and Version Boundary
Installation needs CREATE on the database and public schema. The migration role also needs ALTER on target tables and read/write access to public.eql_v2_configuration; runtime roles normally need USAGE on eql_v2, function execution, configuration read access, and ordinary table privileges.
Dropping public.eql_v2_encrypted can remove dependent application columns. EQL deliberately leaves persistent public types and configuration data outside the replaceable eql_v2 schema, so treat uninstall and major upgrades as data migrations.
Upstream GitHub release 3.0.2 uses a substantially different eql_v3 domain-based API and a release SQL installer. The upstream README warns that dbdev publication can lag GitHub. Do not mix v3 examples with the cataloged cipherstash@eql 2.2.1 package; pin the distribution and follow its matching documentation.