cli icon indicating copy to clipboard operation
cli copied to clipboard

Ltree extension should be in extension or public schema?

Open aishik-pyne opened this issue 2 months ago • 0 comments

Bug report

  • [x] I confirm this is a bug with Supabase, not with my own application.
  • [x] I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

I have a list of migrations where in the begining the 1st migration enables all the extensions. Among several extensions I needed ltree extention. Now unlike other extension where it is supposed to defined in extension schema, there is ambiguity in where tree should be defined. In my second migration I use create a table using one col being type ltree.

Case 1: Define ltree in extension schema

  • supabase db reset works in local db
  • supabase db reset --linked fails saying ERROR: type "ltree" does not exist (SQLSTATE 42704)

Case 2: Define ltree in public schema

  • supabase db reset fails in local db. At the end there is a 502 code
2025/11/25 19:30:09 HTTP GET: http://127.0.0.1:54321/storage/v1/bucket
Error status 502: An invalid response was received from the upstream server

--debug flag doesn't give much information

Case 3: Define ltree in public and extension schema

  • Both local and remote migrations works!
  • Remote DB throws a warning saying
Issue
Extension ltree is installed in the public schema. Move it to another schema.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

  1. Create 1st migration file:
create extension if not exists "ltree"
with
  schema "extensions"; // Or use `public` to test out the other case
  1. Create 2nd migration file:
create table product_taxonomy.categories (
  id text not null,
  locale text not null, 
  version text not null, 
  name text not null, 
  parent_id text,
  tree_path ltree not null, -- hierarchical path (hyphens converted to underscores)
  level integer not null default 0, -- depth in hierarchy (0 = root)
  breadcrumb text not null,
  primary key (id, locale, version),
  -- Self-referential FK ensuring parent exists in same locale & version
  foreign key (parent_id, locale, version) references product_taxonomy.categories (id, locale, version) on delete cascade
);

Expected behavior

Ideally the docs should mention which schema to keep ltree extension in.

Screenshots

NaN

System information

  • OS: macOs
  • Supabase CLI Version: 2.62.5

Additional context

Add any other context about the problem here.

aishik-pyne avatar Nov 25 '25 14:11 aishik-pyne