Files
supabase-vercel-tedd[bot]andAlexis Aguilar 77011f0ed6 docs: enable pgvector in the extensions schema in the Next.js vector search guide (#53772)
## Problem

The Next.js vector search guide enables pgvector with `with schema
public`, but the later SQL declares columns and function parameters as
`extensions.vector(1536)`. A reader who copies the guide's SQL into one
migration gets `ERROR: type "extensions.vector" does not exist` at the
`nods_page_section` table, so `supabase start` fails.

Related to
[FDBKIN-11272](https://linear.app/supabase/issue/FDBKIN-11272/fix-outdated-langchain-sql-guide-using-non-existent-extensionsvector)
Closes
[DOCS-1730](https://linear.app/supabase/issue/DOCS-1730/enable-pgvector-in-the-extensions-schema-in-the-nextjs-vector-search)

## Solution

The "Enable the pgvector extension" step now installs pgvector in the
`extensions` schema, so the `vector` type is where the rest of the
guide's SQL expects it. This also avoids the Security Advisor's
extension-in-public lint and matches the other pgvector pages, which
already use `with schema extensions`. The `extensions.vector` references
stay as they are.

How to verify on the preview:

1. On `/docs/guides/ai/examples/nextjs-vector-search`, the "Enable the
pgvector extension" step shows `create extension if not exists vector
with schema extensions;`.
2. Copying every SQL block of the guide, in order, into one migration
runs without `type "extensions.vector" does not exist`.

## Checks

Ran the page's three SQL blocks in document order in PGlite with
pgvector, after creating an `extensions` schema, an `anon` role, and a
`"$user", public, extensions` search path. Before the change they fail
with `type "extensions.vector" does not exist`. After it they all run,
pgvector sits in `extensions`, and `match_page_sections` returns an
inserted 1536-dimension row. Also ran `pnpm turbo run typecheck
--filter='...[origin/master]'`, `pnpm turbo run lint
--filter='[origin/master]'` (warnings only, none from this page), and
Prettier on the changed file. Skipped the `docs` package tests: they
need Docker.

## Second reader

Verdict: ready. No blockers, no nits. Noted outside this change, left as
follow-ups:

- The page's Dashboard tab runs Studio's OpenAI Vector Search
quickstart, which still installs pgvector in `public`, so the two tabs
now use different schemas. The fix for that belongs in the Studio
snippet.
- Two steps of the SQL tab are both numbered `step={3}`.
- Line 12 says "Store you embeddings".
- The page uses "we/our" in places, against the style guide's voice.

## Checklist

- [x] I have read
[CONTRIBUTING.md](https://github.com/supabase/supabase/blob/master/CONTRIBUTING.md)
- [x] If I wrote a new docs topic or edited an existing topic, I used
the `/write-the-docs` or `/edit-the-docs` skill, which applies the docs
[style
guide](https://github.com/supabase/supabase/tree/master/apps/docs/style-guide)

Co-authored-by: supabase-vercel-tedd[bot] <336548405+supabase-vercel-tedd[bot]@users.noreply.github.com>
Co-authored-by: Alexis Aguilar <98043211+alexisintech@users.noreply.github.com>
2026-11-23 13:51:36 -07:00
..