Skip to content
Planet PostgreSQL·· 12d ago

Vibhor Kumar: Relevance Is Not Permission — Filter-First Vector Search in PostgreSQL

Vibhor Kumar: Relevance Is Not Permission: Filter-First Vector Search in PostgreSQL

Brief · Based on the source excerpt

Vibhor Kumar argues in a Planet PostgreSQL post that permission checks must live in PostgreSQL SQL rather than in application-side filtering after vector retrieval.

Why It Matters

Making access control a property of the data reduces the risk that autonomous agents omit permission checks, while filtering still needs to preserve enough candidates.

Technical Breakdown · Distilled from the original source

Vector similarity does not encode access rights

  • In the article’s internal assistant example, an employee asks about bonus timing. Vector search correctly retrieves relevant passages, including one from an HR-only compensation review. Retrieval works as designed and raises no alert, but the relevance ranking does not determine whether the employee may see the passage.
  • Embeddings represent meaning, not ownership, tenancy, or applicable regulations. A public FAQ and a confidential board memo can be neighbors in vector space simply because they discuss the same topic.

Two filters that depend on the caller

  • Application-side post-filtering retrieves the top k chunks before discarding those the user cannot see. A new agent, a debugging script, or a missed code path can skip that step.
  • A handwritten WHERE clause is an improvement, but an LLM-generated query, a notebook query, or a new microservice can omit it. Both approaches depend on callers consistently applying access rules.

Four requirements for filter-first retrieval

  • The author proposes putting authority in the table and preventing filters from quietly starving the result set. The first concerns who may see the data; the second concerns whether enough results remain after filtering.
  • The other two requirements are to make hard boundaries physical and verify what the agent could see. The supplied excerpt names these patterns without giving implementation details or SQL examples.
Source: Planet PostgreSQL· postgr.es

PG Radar summarizes verified changes and impact. Read the original post for full technical details and code samples.

Read Official Source

Related PostgreSQL Reference