prisma / prisma/orm

Support index ops classes added by extensions (like `pg_trgm` or `btree_gin`)

Open
#17,516 0 comments 4 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/feature topic: index/gin topic: index/gist topic: indexes topic: postgresql topic: postgresqlExtensions
Dominant language
TypeScript
Stars
47.6k
Forks
2.5k
Avg merge
21h 59m
Merged PRs (30d)
95

Description

Problem

Fields in advanced indexes in PostgreSQL, like Gin or Gist, have an operator class "which defines the operators handled by the index", for example: https://www.prisma.io/docs/concepts/components/prisma-schema/indexes#generalized-inverted-index-gin Prisma supports the default operator classes of the different index types, and allows you to define any operator class by using the raw("...") escape hatch.

PostgreSQL extensions like pg_trgm, btree_gist or btree_gin can add additional operator classes for other types to these indexes. Although these extensions can be managed in the Prisma schema via extensions (currently preview feature postgresqlExtensions), this currently leads to validation errors in Prisma Schema, as Prisma does not know that the extension is installed and what operator classes it brings.

Suggested Solution

For common extensions like the ones named above Prisma can know and validate the operator classes and their types.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing PostgreSQL schema validation around the extensions configuration and the postgresqlExtensions preview feature. Compare how built-in operator classes are recognized, then define completion as common classes from extensions such as pg_trgm, btree_gist, and btree_gin validating with their supported types without requiring raw(...).

Written by the indexing model from the issue text.

Assessment

Tech stack
postgresql, typescript
Domain
databases
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.