Took me a while to figure out how to access my Postgres db from self-hosted Supabase (for chat memory on n8n). I couldn’t find a direct solution for this topic, so I thought this might help others having the same issue.
This guide from Supabase explains how to connect:
psql 'postgres://postgres.your-tenant-id:your-super-secret-and-long-postgres-password@localhost:6543/postgres'
So the trick is to create the credentials for Postgres on n8n using port 6543 (for pooled transactional connections), and for the User field, you have to add both your username and tenant_id, joined with a “.”, like the example below:
username.tenant_id
So, if using the default username and set tenant_id as 1234, your User would be:
postgres.1234
(You should have set this tenant id on the .env file during the instalation of supabase.)
Host would be just the IP of your installation and password is what you have also set on the .env file.
Thats is all… Hope it helps!