I get a little confused some times when working with psql
between when to use a set
vs. \set
vs. \pset
. I think that:
set
is for session variables on my connection to the db. For exampleSET ROLE dba
;\set
is for local variables for this psql session. For example\set time 'select current_timestamp'
\pset
is for psql settings for this psql session. For example'\pset border 2'
But, I've never found what I thought was a good explanation of each. Are my assumptions above correct?
I'm using PostgreSQL 9.4
set
is a SQL command and can be used from any SQL client.\set
and\pset
can only be used withpsql
\set
wasn't named\varset
or something.