.\" This is -*-nroff-*- .\" XXX standard disclaimer belongs here.... .\" $Header: /usr/local/cvsroot/pgsql/src/man/psql.1,v 1.23 1998/01/26 01:42:53 scrappy Exp $ .\" Translated by Mitsuhiro Maeda (mitsu@cni.co.jp) .TH PSQL UNIX 1/20/96 日本語PostgreSQL 日本語PostgreSQL .SH 名称 .\" psql - run the interactive query front-end psql - 対話的問い合わせフロントエンドを走らせます .SH 形式 .BR psql [\c .BR "-a" authsvc ] [\c .BR "-A" ] [\c .BR "-c" query ] [\c .BR "-d" dbName] [\c .BR "-e" ] [\c .BR "-f" filename] [\c .BR "-F" separator] [\c .BR "-h" hostname] [\c .BR "-H" ] [\c .BR "-l" ] [\c .BR "-n" ] [\c .BR "-o" filename ] [\c .BR "-p" port] [\c .BR "-q" ] [\c .BR "-s" ] [\c .BR "-S" ] [\c .BR "-t" ] [\c .BR "-T" table-options ] [\c .BR "-u" ] [\c .BR "-x" ] [dbname] .in -5n .SH 説明 .\" psql is a interactive query front-end to Postgres. psql は Postgres への対話的問い合わせフロントエンドです。 .\" It enables you to .\" type in queries interactively, issue them to Postgres, and see the query .\" results. クエリを対話的にタイプし、それを Postgres に発行し、 その問い合わせ結果を見ることができるようになります。 .\" .IR psql .\" can be used in a pipe sequence, and automatically detects when it .\" is not listening or talking to a real tty. .IR psql はパイプにつないで使うこともできますし、 自動的に tty と接続されているかどうか判断します。 .\" .IR psql .\" is designed to be an enhanced version of the older .\" .IR "monitor" .\" program. .IR psql は昔の .IR "monitor" プログラムの拡張としてデザインされています。 .PP .\" .IR "psql" .\" is a frontend application, like any other. .IR "psql" はその他と同じくフロントエンドアプリケーションです。 .\" Hence, a .\" .IR "postmaster" .\" process must be running on the database server host before .\" .IR "psql" .\" is executed. ですから、 .IR "postmaster" プロセスが .IR "psql" が実行される前に データベースサーバのホスト上で走っていなくてはなりません。 .\" In addition, the correct .\" .IR "postmaster" .\" port number must be specified .\" as described below. 加えて、正しい .IR "postmaster" のポート番号が下記のように指定されなくてはなりません。 .PP .\" The optional argument .\" .IR dbname .\" specifies the name of the database to be accessed. オプション引数 .IR dbname はアクセスするデータベースの名前を指定します。 .\" This database must .\" already have been created. このデータベースは既に作られているものでなくてはなりません。 .\" .IR dbname .\" defaults to the value of the .\" .SM USER .\" environment variable or, if that's not set, to the Unix account name of the .\" current user. .IR dbname はデフォルトで環境変数 .SM USER の値、もしくはセットされていなければ、 現在のユーザの Unix アカウント名になります。 .PP .\" When .\" .IR "psql" .\" starts, it reads SQL commands from .\" .IR "/etc/psqlrc" .\" and then from .\" .IR "$(HOME)/.psqlrc" .IR "psql" がスタートすると、 .IR "/etc/psqlrc" と、それから .IR "$(HOME)/.psqlrc" から SQL コマンドを読みます。 .\" This allows SQL commands like .\" .IR SET .\" which can be used to set the date style to be run at the start of .\" evry session. これで .IR SET のような SQLコマンドを 各セッションのスタート時に日付のスタイルをセットするように使うことができます。 .PP .\" .IR "psql" .\" understands the following command-line options: .IR "psql" は次のコマンドラインオプションを取ることができます: .TP .BR "-a" " system" .\" Specifies an authentication system .\" .IR "system" .\" (see .\" .IR pgintro (1)) .\" to use in connecting to the .\" .IR postmaster .\" process. .\" This option no longer has any effect. .IR postmaster プロセスとの接続に使う認証システム .IR "system" を指定します。 ( .IR pgintro (1) を参照してください) このオプションはもう何の効果もありません。 .TP .BR "-A" .\" Turn off fill justification when printing out table elements. 表の要素を出力する際に行揃えをしません .TP .BR "-c" " query" .\" Specifies that .\" .IR "psql" .\" is to execute one query string, .\" .IR "query" , .\" and then exit. .IR "psql" に1つの問い合わせ文字列 .IR "query" を実行させて終了します。 .\" This is useful for shell scripts, typically in .\" conjunction with the .\" .BR -q "" .\" options. これはシェルスクリプトで有用です。 典型的には .BR -q "" オプションとつなげて使います。 .\" .BR -c .\" option in shell scripts. .TP .BR "-d" " dbName" .\" Specifies the name of the database to connect to. 接続するデータベースの名前を指定します .TP .BR "-e" " " .\" Echo the query sent to the backend バックエンドに送られた問い合わせをエコーします .TP .BR "-f" " filename" .\" Use the file .\" .IR "filename" .\" as the source of queries instead of reading queries interactively. 対話的に問い合わせを読む代わりに、 ファイル .IR "filename" をクエリのソースとして使います。 .TP .BR "-F" " separator" .\" Use .\" .IR "separator" .\" as the field separator. .IR "separator" をフィールドの区切り文字として使います。 .\" The default is "|". デフォルトは "|" です。 .TP .BR "-h" " hostname" .\" Specifies the hostname of the machine on which the .\" .IR postmaster .\" is running. .IR postmaster が走っているマシンのホスト名を指定します。 .\" Without this option, communication is performed using .\" local Unix domain sockets. このオプションがないと、 ローカル Unix ドメインソケットを使って接続をします。 .TP .BR "-H" .\" Turns on .\" .SM HTML3.0 .\" tabular output. .SM HTML3.0 テーブル出力をします。 .TP .BR "-l" .\" Lists all available databases すべてのアクセス可能なデータベースをリストアップします。 .TP .BR "-n" .\" Do not use the readline library for input line editing and command history. readline ライブラリを入力の行編集とコマンド履歴に使用しません。 .TP .BR "-o" " filename" .\" Put all output into filename すべての出力を filename に出します。 .TP .BR "-p" " port" .\" Specifies the TCP/IP port or local Unix domain socket file .\" extension on which the .\" .IR postmaster .\" is listening for connections. .IR postmaster が接続を待っている TCP/IP ポートまたは ローカルの Unix ドメインソケットのファイル拡張子を指定します。 .\" Defaults to 5432, or the value of the .\" .SM PGPORT .\" environment variable (if set). デフォルトでは 5432 、 あるいは(セットされていれば)環境変数 .SM PGPORT の値となります。 .TP .BR "-q" .\" Specifies that .\" .IR psql .\" should do its work quietly. .IR psql が寡黙に実行されることを指定します。 .\" By default, it .\" prints welcome and exit messages and prompts for each query, and prints .\" out the number of rows returned from a query. デフォルトでは、 ウエルカムメッセージと終了メッセージを出力し、 各問い合わせにプロンプトを出し、 問い合わせから戻る行数を出力します。 .\" If this option is used, none of this happens. このオプションが使われると、 これらは起こりません。 .\" This is useful with the .\" .BR -c .\" option in shell scripts. これは .BR -c オプションと一緒にシェルスクリプトで使う時に有用です。 .TP .BR "-s" .\" Run in single-step mode where the user at prompted for each query before .\" it is sent to the backend. バックエンドへの各問い合わせが送られる前にユーザにプロンプトを出す シングルステップモードで実行します。 .TP .BR "-S" .\" Run ins single-line mode where each query is terminated by a newline, .\" instead of a semicolon. 各問い合わせがセミコロンではなく、 改行文字によって区切られる シングルラインモードで実行します。 .TP .BR "-t" .\" Turn off printing of column names. カラム名を出力しません。 .\" This is useful with the .\" .BR -c .\" option in shell scripts. これは .BR -c オプションと一緒にシェルスクリプトで使う時に有用です。 .TP .BR "-T" " table-options" .\" Allows you to specify options to be placed within the tag .\" for .\" .SM HTML3.0 .\" tabular output. .SM HTML3.0 のテーブル出力に
タグの中に置くオプションを指定できます。 .\" For example .\" .BR border .\" will give you tables with borders. 例えば、 .BR border はテーブルに罫線が引かれます。 .TP .BR "-u" .\" Asks the user for the user name and password before connecting to the database. データベースに接続する前に、 ユーザにユーザ名とパスワードを訊きます。 .\" If the database does not require password authentication then these are .\" ignored. もしデータベースがパスワード認証を必要としなければ、 これらは無視されます。 .\" If the option i snot used (and the PGPASSWORD environment variable .\" is not set) and the database requires password authentication, then the .\" connection will fail. もしこのオプションが使われず(そして環境変数 PGPASSWORD がセットされず) そしてデータベースがパスワード認証を必要とするなら、 接続は失敗します。 .\" The user name is ignored anyway. ユーザ名はどのみち無視されます。 .TP .BR "-x" .\" Turns on extended row format mode. 拡張行フォーマットモードになります。 .\" When enabled each row will have its column .\" names printed on the left with the column values printed on the right. これが有効になると、 各行はカラム名が左にそしてその値が右に出力されます。 .\" This is useful for rows which are otherwise too long to fit into .\" one screen line. これは行が1行に収めるには長すぎるような時に有用です。 .\" HTML row output supports this mode also. HTML の行出力もこのモードをサポートしています。 .PP .\" You may set environment variables to avoid typing some of the above .\" options. 環境変数をセットすることで、 上記のオプションのいくつかをわざわざタイプする必要がなくなります。 .\" See the .\" .SM "ENVIRONMENT VARIABLES" .\" section below. 下の .SM "環境変数" の節を参照してください。 .\" .SH "CONNECTING TO A DATABASE" .SH "データベースに接続する" .\" .IR psql .\" attempts to make a connection to the database at the hostname and .\" port number specified on the command line. .IR psql はコマンドラインで指定されたホスト名とポート番号で データベースに接続しようと試みます。 .\" If the connection could not .\" be made for any reason (e.g. insufficient privileges, postmaster is not .\" running on the server, etc) .\" .IR psql .\" will return an error that says .\" .nf .\" Connection to database failed. .\" .fi もし接続が何らかの理由(例えば、アクセス権がない、 postmasterがサーバ上で走っていない等)で失敗した場合に、 .IR psql は .nf Connection to database failed .fi というエラーを返します。 .\" The reason for the connection failure is not provided. 接続に失敗した理由は与えられません。 .\" .SH "ENTERING QUERIES" .SH "問い合わせを入力する" .\" In normal operation, psql provides a prompt with the name of the .\" database that psql is current connected to followed by the string "=>". 通常の作業では、 psql は現在接続中のデータベースの名前に "=>" という文字列をつなげた プロンプトを表示します。 .\" For example, 例えば、 .nf Welcome to the POSTGRESQL interactive sql monitor: Please read the file COPYRIGHT for copyright terms of POSTGRESQL type \e? for help on slash commands type \eq to quit type \eg or terminate with semicolon to execute query You are currently connected to the database: testdb testdb=> .fi .PP .\" At the prompt, the user may type in SQL queries. このプロンプトで、 ユーザは SQL クエリをタイプすることができます。 .\" Unless the -S option .\" is set, input lines are sent to the backend when a query-terminating .\" semicolon is reached. -S オプションがセットされていないなら、 インプットされた行は問い合わせを区切るセミコロンに到達した時点で バックエンドに送られます。 .PP .\" Whenever a query is executed, psql also polls for asynchronous notification .\" events generated by .\" .IR listen (l) .\" and .\" .IR notify (l). 問い合わせが実行されるといつも、 psql も .IR listen (l) と .IR notify (l) で引き起こされる非同期の通知イベント受け取ります。 .PP .\" .SH "PSQL COMMANDS" .SH "PSQLコマンド" .\" Anything you enter in psql that begins with an unquoted backslash is a psql .\" command. psql 上で入力するクオートで囲まれていないバックスラッシュで始まるものは psql コマンドです。 .\" Anything else is SQL and simply goes into the current query buffer .\" (and once you have at least one complete query, it gets automatically .\" submitted to the backend). その他はすべて SQL で、単にクエリバッファに溜ります。 (そして少なくともひとつの完全な問い合わせがあれば、 自動的にバックエンドに送られます。) .\" Psql commands are also called slash commands. psqlコマンドはスラッシュコマンドとも呼ばれています。 .PP .\" The format of a psql command is the backslash, followed immediately by .\" a command verb, then any arguments. psqlコマンドのフォーマットは、 バックスラッシュとすぐその後のコマンドの動詞、 そして引数となります。 .\" The arguments are separated from the .\" command verb and each other by any number of white space characters. コマンドの動詞と引数との間はスペース文字で区切られます。 .PP .\" With single character command verbs, you don't actually need to separate the .\" command verb from the argument with white space, for historical reasons. .\" You should anyway. 1文字のコマンド動詞は、 これまでの歴史的配慮から、 スペース文字で引数と区切る必要はありません。 区切るべきでしょうですが。 .IP "\ea" .\" Toggle field alignment when printing out table elements. 表の要素を出力する際の行揃えを切替えます。 .IP "\eC \fIcaption\fR" .\" Set the HTML3.0 table caption. HTML3.0 のテーブルの見出しをセットします。 .IP "\econnect \fIdbname\fR \fIusername\fR" .\" Establish a connection to a new database. 新しいデータベースへの接続を確立します。 .\" The previous connection is closed. その前の接続はクローズされます。 .IP "\ecopy \fItable\fR {FROM | TO} \fIfilename\fR" .\" Perform a frontend copy. フロントエンドコピーを行います。 .\" This is an operation that runs a SQL COPY command, .\" but instead of the backend reading or writing a specified file, and .\" consequently requiring special user privilege, psql reads or writes the .\" file and routes the data to or from the backend. これは、 SQL の COPY コマンドの実行ですが、 バックエンドが指定したファイルの読み書きをする代わりに、 その結果特別なユーザ権限が必要ですが、 psql がファイルの読み書きをして、データをバックエンドとやりとりします。 .IP "\ed [\fItable\fR]" .\" List tables in the database, or if .\" .IR table .\" is specified, list the columns in .\" .IR table. データベースの表をリストアップします。 もし .IR table が指定されれば、 .IR table 中のカラムをリストアップします。 .\" If table name is .\" .IR *, .\" list all tables and column information for each tables. もしテーブル名が .IR * でしたら、 すべてのテーブルと各々のカラムの情報をリストアップします。 .IP "\eda" .\" List aggregates. 集約関数をリストアップします。 .IP "\edd object" .\" List the description of the table, table.column, type, operator, or aggregate. テーブル、テーブル.カラム、型、演算子、集約関数の説明をリストアップします。 .IP "\edf" .\" List functions. 関数をリストアップします。 .IP "\edi" .\" List only indexes. インデックスのみをリストアップします。 .IP "\edo" .\" List operators. 演算子をリストアップします。 .IP "\eds" .\" List only sequences. シーケンスのみをリストアップします。 .IP "\edS" .\" List system tables and indexes. テーブルとインデックスをリストアップします。 .IP "\edt" .\" List only tables. テーブルのみをリストアップします。 .IP "\edT" .\" List types. 型をリストアップします。 .IP "\ee [\fIfilename\fR]" .\" Edit the current query buffer or \fIfile\fR. 現在のクエリバッファもしくは\fIfile\fRを編集します。 .IP "\eE [\fIfilename\fR]" .\" Edit the current query buffer or \fIfile\fR and execute it .\" upon editor exit. 現在のクエリバッファもしくは\fIfile\fRを編集して、 エディタが終了したらそれを実行します。 .IP "\ef [\fIseparator\fR]" .\" Set the field separator. Default is a single blank space. フィールドのクギリ文字をセットします。 デフォルトでは1文字のスペースです。 .IP "\eg [\fI|command\fR] | [\fIfilename\fR]" .\" Send the current query input buffer to the backend and optionally .\" save the output in .\" .IR filename .\" or pipe the output into .\" .IR "|command". 現在のクエリ入力バッファをバックエンドに送り、 オプションとして、出力を .IR filename に保存、またはパイプを通して .IR "|command" に出力します。 .IP "\eh [\fIcommand\fR]" .\" Give syntax help on the specified SQL command. If the .\" .IR command .\" is not specified, list all the commands for which syntax help is .\" available. If the .\" .IR command .\" is .\" .IR *, .\" give syntax help on all SQL commands. 指定した SQL コマンドのヘルプを表示します。 もし .IR command が指定されなければ、 文法のヘルプが用意されているすべてのコマンドをリストアップします。 もし .IR command が .IR * なら、すべての SQL コマンドに付いての文法のヘルプをリストアップします。 .IP "\eH" .\" Toggle html3 output. html3 の出力を切替えます。 .IP "\ei \fIfilename\fR" .\" Read queries from .\" .IR filename .\" into the query input buffer. クエリを .IR filename からクエリ入力バッファに読み込みます。 .IP "\el" .\" List all the databases in the server. サーバのすべてのデータベースをリストアップします。 .IP "\em" .\" Toggle monitor-like table display. .\" This is standard SQL output (i.e extra border characters). monitor のような表の表示を切替えます。 これは標準的な SQL の出力です。 (つまり、余分なボーダー文字のことです。) .IP "\eo [\fI|command\fR] | [\fIfilename\fR]" .\" Send query results to .\" .IR filename . .\" Or pipe into .\" .IR command . 問い合わせの結果を .IR filename に、もしくはパイプを通して .IR command に出力します。 .\" If no arguments are specified, send query results to .\" .IR stdout . もし引数が指定されなければ、 問い合わせの結果は .IR 標準出力 になります。 .IP "\ep" .\" Print the current query buffer. 現在のクエリバッファを表示します。 .IP \eq .\" Quit the psql program. psqlプログラムを終了します。 .IP "\er" .\" Reset(clear) the query buffer. クエリバッファをリセット(クリア)します。 .IP "\es [\fIfilename\fR]" .\" Print or save the command line history to \fIfilename\fR. コマンドラインの履歴を \fIfilename\fR に出力または保存します。 .\" (Only available if psql is .\" configured to use readline) (psql が readline を使うように設定された場合にのみ有効です。) .IP "\et" .\" Toggle display of output column name headings and row count (defaults to on). カラム名のヘッダと行数の表示を切替えます。 (デフォルトではオンになっています。) .IP "\eT" .\" Set html3.0
options. html3.0 の
のオプションをセットします。 .IP "\ex" .\" Toggles extended row format mode. When enabled each row will have its column .\" names printed on the left with the column values printed on the right. .\" This is useful for rows which are otherwise too long to fit into .\" one screen line. HTML row output mode supports this flag too. 拡張行フォーマットモードを切替えます。 これが有効になると、各行はカラム名が左に、そしてその値が右に出力されます。 これは行がスクリーンの1行に収めるには長すぎるような時に有用です。 HTML の行出力もこのモードをサポートしています。 .IP "\ez" .\" Produces a list of all tables in database with their appropriate ACLs .\" (grant/revoke permissions) listed. データベース内のすべてのテーブルを適切な ACL (grant と revoke で定義した権限) を付けてリストアップします。 .IP "\e! [\fIcommand\fR]" .\" Escape to shell or execute .\" .IR command. シェルにエスケープ、あるいは .IR command を実行します。 .IP \e? .\" Get help information about the \e commands. \e コマンドについてのヘルプ情報を表示します。 .\" .SH "ENVIRONMENT VARIABLES" .SH "環境変数" .\" There are some environment variables which can be used in liu of .\" command line arguments; these are detailed below. いくつかの環境変数をコマンドライン引数の代わりに使うことができます。 これらを下に説明します。 .\" Additionally, the Postgres frontend library used by the psql application .\" looks for other optional environment variables to configure, for example, .\" the style of date/time representation and the local time zone. さらに、psql アプリケーションに使われる Postgres のフロントエンドライブラリは 例えば日付や時間の表示スタイルやローカルのタイムゾーンなどの設定をするために 他のオプションの環境変数を期待していることもあります。 .\" Refer .\" to libpq(3) for more details. 詳細については libpq(3) を参照してください。 .PP .\" You may set any of the following environment variables to avoid .\" specifying command-line options: コマンドラインオプションを指定することを避けるように、 次の環境変数をセットすることができます。 .nf hostname: PGHOST port: PGPORT tty: PGTTY options: PGOPTION realm: PGREALM .fi .\" Setting PGHOST to a non-zero-length string causes TCP/IP communication .\" to be used, rather than the default local Unix domain sockets. PGHOST を0より長い文字列にセットすることで、 デフォルトのローカル Unix ドメインソケットではなく TCP/IP の通信を使うことになります。 .PP .\" If .\" .SM PGOPTION .\" is specified, then the options it contains are parsed .\" .BR before .\" any command-line options. もし .SM PGOPTION が指定されると、その中のオプションはコマンドラインオプションよりも .BR 前に 解析されます。 .PP .\" .SM PGREALM .\" only applies if .\" .IR Kerberos .\" authentication is in use. .SM PGREALM は .IR Kerberos 認証が使われているときにのみ適用されます。 .\" If this environment variable is set, Postgres .\" will attempt authentication with servers for this realm and use .\" separate ticket files to avoid conflicts with local ticket files. この環境変数がセットされると、 Postgres はサーバとの認証にこの realm を使おうと試み、 ローカルチケットファイルとの衝突を避けるために 別のチケットファイルを使います。 .\" See .\" .IR pgintro (1) .\" for additional information on .\" .IR Kerberos . .IR Kerberos についてのさらなる情報については .IR pgintro (1) を参照してください。 .\" .SH "RETURN VALUE" .SH "戻り値" .\" .IR psql .\" returns 0 to the shell on successful completion of all queries, .\" 1 for errors, 2 for abrupt disconnection from the backend. .IR psql は、すべての問い合わせがうまく完了すれば 0を、 エラーならば 1 を、そしてバックエンドからの不意の接続終了時に 2を返します。 .\" .IR psql .\" will also return 1 if the connection to a database could not be made for .\" any reason. .IR psql はまた、データベースへの接続を何らかの理由で確立できなかった時にも 1 を返します。 .SH 参照 libpq(3), monitor(1) postgres(1), postmaster(1).