Skip to content

Supabase CLI (Docker local) pg_vector with index crashes Postgres #1074

Closed
@3dteemu

Description

@3dteemu

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

Supabase (or more specifically Postgres) crashes whenever an indexing happens on a vector column.

Error in the Docker logs: server process (PID 604) was terminated by signal 4: Illegal instruction

To Reproduce

Steps to reproduce the behavior:

  1. npx supabase init
  2. npx supabase start
  3. Run docker logs <db container> -f and observe the logs
  4. Open the Studio in the browser, navigate to SQL editor
  5. Execute the following:
create extension if not exists vector
with schema extensions;

create table
  vector_test (
    id bigint generated by default as identity primary key,
    content text,
    embedding vector (10)
  );

create index on vector_test using hnsw (embedding vector_ip_ops);

All should be ok now.

  1. Execute the following:
insert into vector_test (content, embedding) values ('sample text', '[1,2,3,4,5,6,7,8,9,10]');
  • Observe: Error: Connection terminated unexpectedly
  • The Docker logs will show something like this:
2024-07-25 12:24:48.727 UTC [10] LOG:  server process (PID 604) was terminated by signal 4: Illegal instruction
2024-07-25 12:24:48.727 UTC [10] DETAIL:  Failed process was running: 
	-- source: dashboard
	-- user: self host
	-- date: 2024-07-25T12:24:48.555Z
	
	insert into vector_test (content, embedding) values ('sample text', '[1,2,3,4,5,6,7,8,9,10]')

If you switch the order of the index creation and the insert, i.e. first insert data then create the index, the same error happens.
The same error happens also with the ivfflat index and all distance operators.

Expected behavior

An index is created successfully.

System information

  • OS: Ubuntu 24.04 LTS
  • Linux xx 6.8.0-38-generic #38-Ubuntu SMP PREEMPT_DYNAMIC Fri Jun 7 15:25:01 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux
  • Intel® Core™ i7-3930K × 12
  • Docker version: 27.0.3, build 7d4bcd8 (Docker running in rootless mode)
  • Supabase CLI version: 1.187.3
  • Images
public.ecr.aws/supabase/studio:20240701-05dfbec
public.ecr.aws/supabase/postgres-meta:v0.83.2 
public.ecr.aws/supabase/edge-runtime:v1.55.0
public.ecr.aws/supabase/imgproxy:v3.8.0
public.ecr.aws/supabase/storage-api:v1.0.6
public.ecr.aws/supabase/postgrest:v12.2.0 
public.ecr.aws/supabase/realtime:v2.29.15
public.ecr.aws/supabase/inbucket:3.0.3
public.ecr.aws/supabase/gotrue:v2.151.0
public.ecr.aws/supabase/kong:2.8.1
public.ecr.aws/supabase/postgres:15.1.1.61

Additional context

The above works on hosted Supabase.

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