Skip to content

fix(db): create pg_net in extensions schema for clean replay#357

Closed
glassBead-tc wants to merge 1 commit into
mainfrom
fix/pg-net-extension-schema
Closed

fix(db): create pg_net in extensions schema for clean replay#357
glassBead-tc wants to merge 1 commit into
mainfrom
fix/pg-net-extension-schema

Conversation

@glassBead-tc

Copy link
Copy Markdown
Member

Problem

Migration 20260408033928_add_hub_tables_vectors_pgmq_realtime.sql created pg_net with no target schema:

CREATE EXTENSION IF NOT EXISTS pg_net;

On a fresh database — the CI supabase start replay — pgmq and pg_cron are pre-provisioned by Supabase's local stack, but pg_net is not. So pg_net takes the real CREATE EXTENSION path and fails:

ERROR: no schema has been selected to create in (SQLSTATE 3F000)
At statement: CREATE EXTENSION IF NOT EXISTS pg_net

This breaks Schema Drift Check and Test Suite on every migration PR.

Fix

Pin pg_net to the extensions schema, matching the convention already used later in 20260409232440_remote_schema.sql (create extension if not exists "pg_net" with schema "extensions"). The end-state schema is unchanged, so no drift is introduced.

Scoped to pg_net only — pgmq and pg_cron are left as-is because they install into their own expected schemas and do not hit the failing path.

Verification

  • oxlint: 0 warnings / 0 errors
  • Editing an already-applied migration only affects fresh replays (CI / new environments); db push does not re-apply the existing version to staging/prod.

🤖 Generated with Claude Code

Migration 20260408033928 created pg_net with no target schema. On a
fresh database (CI `supabase start` replay), where pg_net is not
pre-provisioned, `CREATE EXTENSION IF NOT EXISTS pg_net` fails with
3F000 "no schema has been selected to create in" — breaking the Schema
Drift Check and Test Suite on every migration PR. Pin it to the
extensions schema, matching the convention already used in
20260409232440.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel

vercel Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
thoughtbox-web-two Ready Ready Preview, Comment Jun 8, 2026 6:33am

@supabase

supabase Bot commented Jun 8, 2026

Copy link
Copy Markdown

This pull request has been ignored for the connected project akjccuoncxlvrrtkvtno due to reaching the limit of concurrent preview branches.
Go to Project Integrations Settings ↗︎ if you wish to update this limit.


Preview Branches by Supabase.
Learn more about Supabase Branching ↗︎.

@greptile-apps

greptile-apps Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Pins pg_net to the extensions schema in the 20260408033928 migration, fixing a 3F000 error on fresh database replays where pg_net is not pre-provisioned by Supabase's local stack.

  • Adds WITH SCHEMA extensions to the bare CREATE EXTENSION IF NOT EXISTS pg_net statement, aligning it with the same convention used in 20260409232440_remote_schema.sql.
  • The change is scoped to one line; pgmq and pg_cron are left untouched because they self-install into their own expected schemas and do not hit the failing code path. net.http_post references within the migration remain valid because pg_net places its functional objects in the net schema regardless of the catalog schema specifier.

Confidence Score: 5/5

Safe to merge — the change is a single-line addition that fixes CI on fresh replays without altering end-state schema.

The edit adds WITH SCHEMA extensions to one CREATE EXTENSION call. It matches the identical line already present in 20260409232440_remote_schema.sql, so the conventions are consistent. The net.http_post calls in the same migration reference the net schema directly, which is where pg_net places its functional objects regardless of the catalog schema specifier — so no runtime breakage is introduced. Existing environments are unaffected because Supabase does not re-apply already-recorded migrations.

No files require special attention.

Important Files Changed

Filename Overview
supabase/migrations/20260408033928_add_hub_tables_vectors_pgmq_realtime.sql Single-line fix: pins pg_net to the extensions schema, resolving fresh-replay CI failures. Consistent with the convention already present in 20260409232440_remote_schema.sql; no functional or schema-drift impact.

Sequence Diagram

sequenceDiagram
    participant CI as CI (supabase start)
    participant PG as PostgreSQL
    participant NET as pg_net (net schema)

    Note over CI,PG: Fresh replay — pgmq & pg_cron pre-provisioned, pg_net is NOT
    CI->>PG: 20260408033928 migration
    Note over PG: Before fix: CREATE EXTENSION IF NOT EXISTS pg_net
    PG-->>CI: ERROR 3F000: no schema selected
    Note over PG: After fix: CREATE EXTENSION IF NOT EXISTS pg_net WITH SCHEMA extensions
    PG->>NET: Extension registered under extensions schema
    Note over NET: Functional objects still created in net schema
    PG-->>CI: OK
    CI->>PG: invoke_process_thought_queue_from_vault(...)
    PG->>NET: net.http_post(...) — resolves via search_path / explicit qualifier
    NET-->>PG: HTTP request ID (bigint)
    PG-->>CI: OK
Loading

Reviews (1): Last reviewed commit: "fix(db): create pg_net in extensions sch..." | Re-trigger Greptile

@glassBead-tc

Copy link
Copy Markdown
Member Author

Superseded by #359, which includes this pg_net fix plus the full Test Suite repair. main is green.

@glassBead-tc
glassBead-tc deleted the fix/pg-net-extension-schema branch June 8, 2026 13:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant