help with pgvector

amphy0
HOBBY

14 days ago

how do i enable pgvector for my database? when i tried using existing pgvector images, it gave me ssl error

$10 Bounty

9 Replies

Railway
BOT

14 days ago

Hey there! We've found the following might help you get unblocked faster:

If you find the answer from one of these, please let us know by solving the thread!


14 days ago

This thread has been marked as public for community involvement, as it does not contain any sensitive or personal information. Any further activity in this thread will be visible to everyone.

Status changed to Open brody 14 days ago


idiegea21
HOBBYTop 10% Contributor

13 days ago

You don't need a custom image — Railway already offers pgvector support via templates and built-in Postgres images.


idiegea21
HOBBYTop 10% Contributor

13 days ago

To enable it, you just need to run this SQL command in your Railway Postgres database: CREATE EXTENSION IF NOT EXISTS vector;

You can do this via the Railway dashboard’s query editor or your fav SQL client connected to the Railway database.


idiegea21

You don't need a custom image — Railway already offers pgvector support via templates and built-in Postgres images.

amphy0
HOBBY

13 days ago

when i try to use a pgvector template, i couldnt connect to the database due to a ssl error, but the ssl error doesnt happen with the base postgres template


idiegea21
HOBBYTop 10% Contributor

13 days ago

If you’re getting SSL errors with the pgvector template, but not with the base Postgres one, try using the base Postgres template (which works without SSL issues) and just enable pgvector manually by running: CREATE EXTENSION IF NOT EXISTS vector; inside the database (via Railway’s query editor or your SQL client).

This way, you don’t have to deal with the pgvector template’s SSL settings at all. you get a clean base Postgres instance with pgvector enabled.

Hope this helps?


idiegea21

If you’re getting SSL errors with the pgvector template, but not with the base Postgres one, try using the base Postgres template (which works without SSL issues) and just enable pgvector manually by running: CREATE EXTENSION IF NOT EXISTS vector; inside the database (via Railway’s query editor or your SQL client).This way, you don’t have to deal with the pgvector template’s SSL settings at all. you get a clean base Postgres instance with pgvector enabled.Hope this helps?

amphy0
HOBBY

13 days ago

thats the issue, the base postgres template does not have pgvector installed, so the sql command does not work


idiegea21
HOBBYTop 10% Contributor

13 days ago

Actually, the base Postgres template does support running the SQL command to install pgvector the extension is available to enable, but it’s not installed by default. So running that should without issues on the base Postgres database in Railway.

If you’re getting an error running that command, it might be due to permissions or something else. can you share the exact error message you get when you try to run iton the base Postgres template?


amphy0
HOBBY

13 days ago

this is the error that i'm getting if i try to run the command on a base postgres template:
railway=# CREATE EXTENSION IF NOT EXISTS vector;

ERROR: extension "vector" is not available

DETAIL: Could not open extension control file "/usr/share/postgresql/16/extension/vector.control": No such file or directory.

HINT: The extension must first be installed on the system where PostgreSQL is running.

railway=#


amphy0

this is the error that i'm getting if i try to run the command on a base postgres template:railway=# CREATE EXTENSION IF NOT EXISTS vector;ERROR: extension "vector" is not availableDETAIL: Could not open extension control file "/usr/share/postgresql/16/extension/vector.control": No such file or directory.HINT: The extension must first be installed on the system where PostgreSQL is running.railway=#

idiegea21
HOBBYTop 10% Contributor

13 days ago

Oh i get the issue now, the base Postgres template on Railway doesn’t have thepgvectorextension installed on the underlying system, which is why the CREATE EXTENSION command fails. That extension needs to be present on the server level, not just in the database.

Instead of avoiding the pgvector template, let's fix the SSL issue so you can use it properly. add this parameter to the end of your sql connection string ?sslmode=require

That should fix the SSL issue and let you use the pgvector template without needing a custom image.


help with pgvector - Railway Help Station