Skip to content

Supabase Vector Store Node ignores the Table Name field and always uses the "documents" table #12906

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
blinkin69 opened this issue Jan 28, 2025 · 11 comments
Labels
in linear Issue or PR has been created in Linear for internal review

Comments

@blinkin69
Copy link

Bug Description

The Supabase Vector Store Node in n8n does not respect the Table Name field. Regardless of what is entered in this field, the node always queries the default "documents" table.

Actual Behavior:
The node always queries the documents table, even if a different table name is configured.

Image

To Reproduce

Steps to Reproduce:

Create two tables in Supabase: documents and custom_table.
Configure the Supabase Vector Store Node in n8n and set the Table Name field to custom_table.
Execute the workflow.
Observe that the node still fetches data from the documents table, ignoring the Table Name configuration.
Expected Behavior:
The node should query the table specified in the Table Name field (e.g., custom_table).

Expected behavior

The node should query the table specified in the Table Name field (e.g., custom_table).

Operating System

n8n cloud

n8n Version

1.75.2

Node.js Version

x

Database

PostgreSQL

Execution mode

main (default)

@Joffcom
Copy link
Member

Joffcom commented Jan 28, 2025

Hey @blinkin69,

We have created an internal ticket to look into this which we will be tracking as "GHC-645"

@Joffcom Joffcom added the in linear Issue or PR has been created in Linear for internal review label Jan 28, 2025
@Joffcom
Copy link
Member

Joffcom commented Feb 11, 2025

Hey @blinkin69,

This is possibly not an issue with the n8n application itself and more than likely a problem with the match function you are using, Can you check in Supabase to see what the function is doing I suspect it will have a FROM documents line in it which will be where this error is coming from.

@Joffcom Joffcom added the Needs Feedback Waiting for further input or clarification. label Feb 13, 2025
@Joffcom Joffcom added Needs Feedback Waiting for further input or clarification. and removed Needs Feedback Waiting for further input or clarification. labels Mar 12, 2025
@tedvo
Copy link

tedvo commented Mar 17, 2025

@Joffcom I think you are right. I have check the function match_documents and see it is using table documents.

-- Create a function to search for documents
create function match_documents (
query_embedding vector(1536),
match_count int default null,
filter jsonb DEFAULT '{}'
) returns table (
id bigint,
content text,
metadata jsonb,
similarity float
)
language plpgsql
as $$
#variable_conflict use_column
begin
return query
select
id,
content,
metadata,
1 - (documents.embedding <=> query_embedding) as similarity
from documents
where metadata @> filter
order by documents.embedding <=> query_embedding
limit match_count;
end;
$$;

@Joffcom Joffcom removed the Needs Feedback Waiting for further input or clarification. label Mar 17, 2025
@Joffcom
Copy link
Member

Joffcom commented Mar 19, 2025

Hey @blinkin69

That will be it you will need to update the function for this to work.

As this doesn't look to be a bug I will mark this as closed but I will also update the docs shortly to mention this as others may run into the same problem.

@Joffcom Joffcom closed this as not planned Won't fix, can't repro, duplicate, stale Mar 19, 2025
@Ankit-Mahadani
Copy link

any solutions?

@squarezw
Copy link

faced same situation, if the Table settings in n8n is not useful, can we change it to "match func name" instead of default function?

@flewis88
Copy link

Has anybody come up with a match_function which will pass in the selected table name and use the correct SQL table? Given there is a native Supabase integration in n8n with the table select, surely this has been investigated

@platnub
Copy link

platnub commented May 31, 2025

You can achieve this with a custom query option like this:

Image

@flewis88
Copy link

You can achieve this with a custom query option like this:

Image

This is incredible! Exactly what I've been looking for. Will try today.

@platnub
Copy link

platnub commented May 31, 2025

You can achieve this with a custom query option like this:
Image

This is incredible! Exactly what I've been looking for. Will try today.

Make sure to fully edit the SQL command like I did below for my use case.

-- Create a function to search for documents
create function match_fortigate_documents (
  query_embedding vector(3584),
  match_count int default null,
  filter jsonb DEFAULT '{}'
) returns table (
  id bigint,
  content text,
  metadata jsonb,
  similarity float
)
language plpgsql
as $$
#variable_conflict use_column
begin
  return query
  select
    id,
    content,
    metadata,
    1 - (fortigate_documents.embedding <=> query_embedding) as similarity
  from fortigate_documents
  where metadata @> filter
  order by fortigate_documents.embedding <=> query_embedding
  limit match_count;
end;
$$;

@flewis88
Copy link

flewis88 commented Jun 1, 2025

Definitely. In fact I have the respective functions set up already, just couldn't work out how to call them. I've been looking into the source code to see if table name is being passed to Supabase already and whether table name could be a variable in match_documents function

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in linear Issue or PR has been created in Linear for internal review
Projects
None yet
Development

No branches or pull requests

7 participants