Question about Database connection string #29693
QuestionHi there, Does Prisma automatically add :5432 to the localhost? Example i set it to localhost, does it set it to localhost:5432? Thanks How to reproduce (optional)No response Expected behavior (optional)No response Information about Prisma Schema, Client Queries and Environment (optional)No response |
Replies: 3 comments 1 reply
|
Yeah, Prisma fills in 5432 when you leave the port off. Just tested on 6.19.3: with It's baked into the connection parser (quaint): |
Reply: Database connection stringYes, for a PostgreSQL datasource Prisma defaults to port So if you write: Prisma treats it as: Why this happensPrisma uses PostgreSQL's standard default port. The Prisma codebase also reflects this default directly in its connection handling, where PostgreSQL resolves to When to set the port explicitlySet the port yourself if:
Short answerIf you leave the port off, Prisma will use Official docs: |
|
Yeah it does. If you leave the port off, the Postgres driver just falls back to its default, which is 5432. So these two end up being the same thing:
Couple of things worth keeping in mind:
So for a normal local Postgres you're fine leaving Hope that clears it up. If it was useful it'd be great if you could mark it as the answer 🙏 |
Yeah it does. If you leave the port off, the Postgres driver just falls back to its default, which is 5432. So these two end up being the same thing:
localhostwith no port becomeslocalhost:5432.Couple of things worth keeping in mind: