Here are SOME links to some psql features:

http://www.postgresqltutorial.com/psql-commands/

http://www.postgresqltutorial.com/postgresql-list-users/

http://www.postgresqltutorial.com/postgresql-describe-table/

The most current PostgreSQL docs. as of 09/10/2018 – see appendix VI page 1793 for psql

# start psql – and connect to a running redshift instance – the ‘-f small_data_load.sql” is optional to run the script – omit “-f file” to simply connect

psql -h my-dw-instance.XXX-XXX.redshift.amazonaws.com -U mfoster -d mydb -p 5439 -f small_data_load.sql

# show psql commands

\?

# show sql commands

\h

# show history

\s

# output to file

\o filename

# edit the last command with your default editor

\e

# toggle html mode on

\H

mydb=# select l_orderkey, l_partkey, l_suppkey, l_linenumber, l_quantity, l_extendedprice from lineitem limit 10;

(10 rows)

mydb=#

l_orderkey l_partkey l_suppkey l_linenumber l_quantity l_extendedprice
12001858 202002 2003 3 5.00 4519.95
12001858 202002 2003 3 5.00 4519.95
12001858 202002 2003 3 5.00 4519.95
12001858 202002 2003 3 5.00 4519.95
12001858 202002 2003 3 5.00 4519.95
12001858 202002 2003 3 5.00 4519.95
12001858 202002 2003 3 5.00 4519.95
12001858 202002 2003 3 5.00 4519.95
12001858 202002 2003 3 5.00 4519.95
12001858 202002 2003 3 5.00 4519.95

Leave a Reply

Your email address will not be published. Required fields are marked *