mirror of
https://github.com/cheat/cheat.git
synced 2024-11-16 17:08:29 +01:00
+html output
This commit is contained in:
parent
2a6ec9cef5
commit
86ba22e7b8
1 changed files with 18 additions and 13 deletions
|
@ -1,21 +1,26 @@
|
||||||
#psql is the PostgreSQL terminal interface. The following commands were tested on version 9.5.
|
# psql is the PostgreSQL terminal interface. The following commands were tested on version 9.5.
|
||||||
#Connection options:
|
# Connection options:
|
||||||
#-U username (if not specified current OS user is used).
|
# -U username (if not specified current OS user is used).
|
||||||
#-p port.
|
# -p port.
|
||||||
#-h server hostname/address.
|
# -h server hostname/address.
|
||||||
|
|
||||||
#Connect to a specific database:
|
# Connect to a specific database:
|
||||||
psql -U postgres -h serverAddress -d dbName
|
psql -U postgres -h serverAddress -d dbName
|
||||||
|
|
||||||
#Get databases on a server:
|
# Get databases on a server:
|
||||||
psql -U postgres -h serverAddress --list
|
psql -U postgres -h serverAddress --list
|
||||||
|
|
||||||
#Execute sql query and save output to file:
|
# Execute sql query and save output to file:
|
||||||
#Add -t to get only rows as result.
|
psql -U postgres -d dbName -c 'select * from tableName;' -o fileName
|
||||||
psql -U postgres -d dbName -c 'select * from tableName;' -o 'fileName'
|
|
||||||
|
|
||||||
Read commands from file:
|
# Execute query and get tabular html output:
|
||||||
|
psql -U postgres -d dbName -H -c 'select * from tableName;'
|
||||||
|
|
||||||
|
# Execute query and save resulting rows to csv file:
|
||||||
|
psql -U postgres -d dbName -t -A -P fieldsep=',' -c 'select * from tableName;' -o fileName.csv
|
||||||
|
|
||||||
|
# Read commands from file:
|
||||||
psql -f fileName
|
psql -f fileName
|
||||||
|
|
||||||
#Restore databases from file:
|
# Restore databases from file:
|
||||||
psql -f /fileName.backup postgres
|
psql -f fileName.backup postgres
|
||||||
|
|
Loading…
Reference in a new issue