Supabase SQL Question

Well I dont know if there are SQL people in these forums but, Supabase support is so bad, I’m resorting to trying to see if anyonein here know what this SQL filter isnt working from wewebs end.

Here is the SQL:

create or replace function action_description (
query_embedding vector (1536),
match_threshold float,
match_count int,
tasks bigint
) returns table (id bigint, similarity float, tasks bigint) language sql stable as $$
select
“Actions”.id,
1 - (“Actions”.description_embedding <=> query_embedding) as similarity,
“Actions”.tasks
from “Actions”
where 1 - (“Actions”.description_embedding <=> query_embedding) > match_threshold
and “Actions”.tasks = tasks
order by similarity desc
limit match_count;
$$;

Im wondering why, the line here - and “Actions”.tasks = tasks - Isnt sorting by the # given. For example, see the screen shot. The # is 97 that it should be sorting by, but its pulling in whatever matches and disregarding the and statement. Im looking at you @broberto fora a hail mary lol! Thanks guys!

Hey @Jonny :wave:

Only following this because I’m not an SQL expert unfortunately :confused: Or maybe I should say not yet! :smile::muscle:

I’m guessing you already tried testing the query in Supabase with help from their AI assistant?

Yes and don’t forget to Opt in to send data to OpenAI in your project settings , and make sure that SQL AI uses it through SQL AI setting in order to give more relevant answers

Will try to help as soon as I finish something

1 Like