Skip to content

fix(db): qualify cross-function calls in search migration#66

Merged
zacharias-ona merged 1 commit into
mainfrom
fix/search-migration-schema-path
Apr 15, 2026
Merged

fix(db): qualify cross-function calls in search migration#66
zacharias-ona merged 1 commit into
mainfrom
fix/search-migration-schema-path

Conversation

@zacharias-ona
Copy link
Copy Markdown
Collaborator

Problem

The Deploy Migrations workflow has failed on every push to main since PR #53 was merged — 4 consecutive failures, all with:

ERROR: function extract_text_from_lexical(jsonb) does not exist (SQLSTATE 42883)

The search migration (20260415111351_add_page_search_vector.sql) has never been applied to production.

Root Cause

Both page_search_vector and search_pages functions use set search_path = '' (a Supabase security best practice), but call extract_text_from_lexical(content) without schema qualification. With an empty search path, PostgreSQL cannot resolve the unqualified function name.

The PR dry-run passed because supabase db push --dry-run only checks which migrations are pending — it doesn't execute the SQL.

Fix

Prefix cross-function calls with public. so they resolve correctly under an empty search path. Self-recursive calls within extract_text_from_lexical are unaffected (a function's own name is always resolvable during execution).

Closes #53's deployment gap — no new issue created since this is a direct fix for the broken migration.

Both page_search_vector and search_pages call extract_text_from_lexical
without schema qualification. With set search_path = '' (empty), PostgreSQL
cannot resolve the function, causing every Deploy Migrations run to fail
since PR #53 was merged.

Prefix calls with public. so they resolve under an empty search path.

Co-authored-by: Ona <no-reply@ona.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 15, 2026

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

Project Deployment Actions Updated (UTC)
memo Ready Ready Preview, Comment Apr 15, 2026 1:54pm

Request Review

@zacharias-ona zacharias-ona merged commit 9020a54 into main Apr 15, 2026
5 checks passed
@zacharias-ona zacharias-ona deleted the fix/search-migration-schema-path branch April 15, 2026 13:55
@zacharias-ona
Copy link
Copy Markdown
Collaborator Author

✅ UI verification skipped — no UI files changed (only supabase/migrations/).

@zacharias-ona
Copy link
Copy Markdown
Collaborator Author

✅ Post-merge verification passed.

Routes tested:

  • / — Landing page loaded, title present
  • /sign-in — Page loaded, email input found
  • /api/health — Endpoint returned OK
  • /dashboard — No 5xx errors (redirected as expected for unauthenticated access)
  • Console errors check — No errors detected

Skipped: None — all routes exist and passed.

zacharias-ona added a commit that referenced this pull request Apr 15, 2026
PR #66 qualified cross-function calls with public. but the CREATE
FUNCTION statements themselves had no schema prefix. On Supabase hosted
projects the migration runner's search_path may not default to public,
so the functions were created in the wrong schema while the qualified
calls pointed at public — where nothing existed.

Prefix all CREATE FUNCTION, ALTER TABLE, and CREATE INDEX statements
with public. so the migration is fully schema-explicit and independent
of the session's search_path.

Co-authored-by: Ona <no-reply@ona.com>
zacharias-ona added a commit that referenced this pull request Apr 15, 2026
PR #66 qualified cross-function calls with public. but the CREATE
FUNCTION statements themselves had no schema prefix. On Supabase hosted
projects the migration runner's search_path may not default to public,
so the functions were created in the wrong schema while the qualified
calls pointed at public — where nothing existed.

Prefix all CREATE FUNCTION, ALTER TABLE, and CREATE INDEX statements
with public. so the migration is fully schema-explicit and independent
of the session's search_path.

Co-authored-by: Ona <no-reply@ona.com>
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