Skip to content

Ltree extension should be in extension or public schema? #4572

@aishik-pyne

Description

@aishik-pyne

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions