1 / 8

PostgreSQL ยท SQL foundations

A client talks to a server

PostgreSQL has a server process that stores data and executes SQL. psql is one client: it opens a connection to the server, sends SQL, then displays the result. Your app, an admin GUI, and psql can all be clients for the same database.

psql "postgresql://app:secret@localhost:5432/shop"

The connection string identifies a host, port, database, and credentials. On a local machine, the host and port may be omitted when psql can use its defaults. A failed connection is a connection/configuration problem; a syntax error after connecting is a SQL problem.