scribase
APIs and HTTPversion 1.6.2

pg_graphql

A GraphQL API over your tables at /graphql/v1.

What it is for

pg_graphql reflects your schema into a GraphQL schema inside the database: each table becomes a collection with filtering, ordering and cursor pagination, and foreign keys become nested fields. Queries are resolved by a single SQL function, so row level security applies as it does for REST.

Enable it

sql
create extension if not exists pg_graphql;

Example

sql
-- resolve a query from SQL
select graphql.resolve($$
  {
    postsCollection(first: 5, orderBy: [{ id: DescNullsLast }]) {
      edges { node { id title } }
    }
  }
$$);

-- or over HTTP: POST <Project URL>/graphql/v1 with the same query

Questions

How do I enable pg_graphql?

Run create extension if not exists pg_graphql; in the SQL editor, or switch it on from the Extensions page in the console. You do not need superuser access.

Which version of pg_graphql is installed?

1.6.2, on Postgres 17.6, as read from the running engine on 2026-10-08. Check yours with: select extversion from pg_extension where extname = 'pg_graphql';

Upstream project: github.com/supabase/pg_graphql

More apis and http extensions

  • pg_net Send HTTP requests from SQL, triggers and cron jobs.
  • pg_jsonschema Check json and jsonb values against a JSON Schema in a CHECK constraint.