PostgreSQL: Setup on the Local Machine
Learn how to set up a local environment for PostgreSQL and the psqlrc file for your specific use case.
We'll cover the following...
Setting up a local environment
We’re providing you with an execution environment with PostgreSQL running. If you want to later practice on your own machine, you will need a database server to play along with.
-
If you’re using MacOSX, check out Postgres App to install a PostgreSQL server and the
psql
tool. -
For Windows, check this link.
-
If you’re mainly running Linux, you know what you’re doing already, right? Look at the PostgreSQL packages for Debian and Ubuntu and install the most recent version of PostgreSQL on your station so that you have something to play with locally. For Red Hat packaging-based systems, check this out.
You might prefer a more visual tool such as
The psqlrc setup
Here we begin with a full setup of psql—we’re going to get back to each important point separately. Doing so allows us to have a fully working environment from the get-go and play around in our PostgreSQL console.
\set PROMPT1 '%~%x%# '
\x auto
\set ON_ERROR_STOP on
\set ON_ERROR_ROLLBACK interactive
\pset null '¤'
\pset linestyle 'unicode'
\pset
...