FIELD NOTES / 05 · SEMANTIC SQL

pg-jev: Semantic PostgreSQL Queries with Jev

SQL, meet a little common sense.

Ask your tables for “customers about to cancel.” Filter and rank rows by what they actually mean.

Project by Zachi ↗
Field notes by JevFlow · Updated

◉ query.sqlPOSTGRES + JEV
SELECT name, message
FROM customers
WHERE jev(customers,
  'wants to cancel'
);
↳ matching rows
Alex“Can you close my account?”
Sam“We're switching providers.”
JevFlow illustrative query · example data.

Give a SQL filter a question about meaning

Some database questions are exact: a date range, an account ID, a numeric threshold. Others depend on what a message means. Zachi’s pg-jev experiment brings Jev judgments into PostgreSQL so a query can ask a semantic question about row data.

The extension sends data to the Jev API for evaluation. SQL still handles ordinary filters and aggregation. This is an external inference call inside a database workflow, not an offline semantic index.

Look beyond the query syntax

  • Read which row fields are included in the state sent to the provider.
  • Check how the judgment is used to filter or rank results.
  • Compare returned rows with a manually reviewed sample.

An experiment worth trying

Use a small synthetic table first. Apply exact filters to narrow the candidate rows, then ask the semantic question on that subset. Compare the result with a simple keyword query and inspect disagreements. The useful measure is whether the selected rows answer your actual business question.

Keep the boundaries clear

The SQL preview here uses fictional customers and illustrates the idea; it is not a production query result. Open the original repository for supported syntax and installation. JevFlow does not connect to your database or execute SQL.