まずは、コマンドプロンプトをまず開いて下記のように"psql --help"と入力して下さい。




This is psql 8.1.3, the PostgreSQL interactive terminal.


General options:

-d DBNAMEspecify database name to connect to (default: "xxxxx")
-c COMMANDrun only single command (SQL or internal) and exit
-f FILENAMEexecute commands from file, then exit
-llist available databases, then exit
-v NAME=VALUEset psql variable NAME to VALUE
-Xdo not read startup file (~/.psqlrc)
--helpshow this help, then exit
--versionoutput version information, then exit

Input and output options:

-aecho all input from script
-eecho commands sent to server
-Edisplay queries that internal commands generate
-qrun quietly (no messages, only query output)
-o FILENAMEsend query results to file (or |pipe)
-ndisable enhanced command line editing (readline)
-ssingle-step mode (confirm each query)
-Ssingle-line mode (end of line terminates SQL command)
-L FILENAMEsend session log to file

Output format options:

-Aunaligned table output mode (-P format=unaligned)
-HHTML table output mode (-P format=html)
-tprint rows only (-P tuples_only)
-T TEXTset HTML table tag attributes (width, border) (-P tableattr=)
-xturn on expanded table output (-P expanded)
-P VAR[=ARG]set printing option VAR to ARG (see ¥pset command)
-F STRINGset field separator (default: "|") (-P fieldsep=)
-R STRINGset record separator (default: newline) (-P recordsep=)

Connection options:

-h HOSTNAMEdatabase server host or socket directory (default: "local socket")
-p PORTdatabase server port (default: "5432")
-U NAMEdatabase user name (default: "xxxxx")
-Wprompt for password (should happen automatically)

For more information, type "¥?" (for internal commands) or "¥help" (for SQL commands) from within psql, or consult the psql section in the PostgreSQL documentation.


例えば"psql --version"と入力して頂くとPostgreSQLのバージョンを確認できます。



( Written by Tatsuo Ikura )

関連記事 (一部広告含む)