🌱 Tim's Dev Wiki

Search IconIcon to open search

PostgreSQL

Last updated September 16, 2022.

PostgreSQL is an object-relational DBMS that is SQL-compliant. Postgres being an ‘object-relational’ DBMS means that it supports table inheritance and function overloading, inspired by OOP. It’s an open-source successor to the proprietary Ingres DBMS, hence the name ‘Postgres’.

# PSQL CLI

Launching psql and connecting to a local or remote database server:

1
2
3
4
5
6
7
8
psql -h localhost -p 5432 -U <user> -d <db_name>

# Or you can use the probably friendlier standard database connection URI string:
psql "postgresql://<user>:<password>@<host+port>/<db_name>"

# For example, connecting to the 'techsuite' database at localhost:5432 with the
# username 'tim' whose password is '1989'.
psql "postgresql://tim:1989@localhost:5432/techsuite"