Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Change pgvector post to use inlinable function

Steve Chavez26f7b4a5962c
diff --git a/apps/www/_blog/2023-02-03-openai-embeddings-postgres-vector.mdx b/apps/www/_blog/2023-02-03-openai-embeddings-postgres-vector.mdx
index d5cc8a6a4b4..d773d57c016 100644
--- a/apps/www/_blog/2023-02-03-openai-embeddings-postgres-vector.mdx
+++ b/apps/www/_blog/2023-02-03-openai-embeddings-postgres-vector.mdx
@@ -113,10 +113,8 @@ returns table (
content text,
similarity float
)
-language plpgsql
+language sql stable
as $$
-begin
- return query
select
documents.id,
documents.content,
@@ -125,7 +123,6 @@ begin
where 1 - (documents.embedding <=> query_embedding) > match_threshold
order by similarity desc
limit match_count;
-end;
$$;
```