RAG with Postgres

Hii guys…
I need to solve a problem about inserting into a database.
I loaded a RAG model with supabase.

I’m trying to switch the supabase node to postgres node, but I don’t know how to execute a function on the postgres node.
Maybe you can show me a way.

Supabase
Delete
metadata->>file_id=like.{{ $json.file_id }}

Insert
match_documents

Read
match_documents

Postgres
Delete
DELETE FROM documents
WHERE metadata->>‘file_id’ ILIKE ‘%’ || ‘{{ $json.file_id }}’ || ‘%’;

Insert
I left the “metadata” function blank

Read
I don’t know how to indicate the “match” query

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hey @brauliodiasribeiro

Do you know how to do it outside of n8n if you were using a Postgres client?

I don’t have an answer for this one as it isn’t really an n8n question and is more of a Postgres question but I can do some digging online to see if I can find any information on how to do it.

I don’t know how to do it directly in postgres.
From what I understand, the supabase node already does this search within itself, so apparently it is not possible to do it in the postgress node.

I’m trying to install this on postgres because it’s easier to do it self-hosted (I am using Unraid).

Postgres is a single docker, and supabase installs multiple dockers.

@brauliodiasribeiro in the supabase node we use the API of supabase rather than a direct query which makes life easier.

Have you tried using the pgvector node instead?

This is what I tried to use in the first post and as I explained there is no match option. And it is necessary to make the RAG

This is the flow, and I’m trying to change supabase to postgres, but there is no opcap match.

The only thing I can find is here in the supabase docs: Semantic search | Supabase Docs

I can’t work out if it can work directly with postgres or if needs something in pgvector.

I’m using pgvector on postgres.
But I gave up, because apparently it’s not possible, I would have to create a node specifically for postgres and I don’t have the knowledge to do that.
I’m going to use Supabase. Thanks for your help.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.