4 Utilities
PDF page 18
The following sections describe the major enhancements of the utility commands.
3.2.1 psql
The following features in psql command has been added.
Prompt setting
The Process ID of the backend process can be set now in the prompt of the psql command. To set the Process ID , Specify the %p to the variable PROMPT1, PROMPT2, PROMPT3.
Backslash commands
The following enhancements have been made.
| \ev view_name | Added | Change the View definition by an external editor |
|---|---|---|
| \svview_name | Added | Show the View definition |
| \sv+view_name | Added | Show the View definition with line numbers |
| \gexec | Added | Run the SQL statements in the output result |
| \errverbose | Added | Show the error information that occurred just before |
| \crosstabviewcolumn_name | Added | Show the cross tabulation |
| \x auto | Changed | Does not use extended table format with EXPLAIN ANALYZE statement |
| \watch and \pset title | Changed | Show the value of the \pset title when executing the \watch command |
Command Modification Description
PDF page 19
Show and edit the VIEW definition.
\ev and \sv command has been added to the psql command. \ev command edits the specified view definition in the editor. \sv command shows the specified view definition. The \sv+ command displays the line number in the view definition.
Execute result(s) of previous query as new queries.
\gexec command executes the result(s) of the SQL Statement just before as new SQL Statements. This is useful when creating the CREATE statement to generate the object using the SELECT statement.
\watch and \pset title
At the time of execution in the \watch command, the string specified in the \pset title command is now displayed.
PDF page 20
Multiple -c option and -f option
-c option and -f option that specify the SQL statement to be executed at the time of connection, can now be specified multiply.
3.2.2 pg_basebackup
–slot (or -S) option that specify the slot name to be used for the backup has been added to pg_basebackup command. If non-existent slot name is specified, a warning will be shown, but the backup process will be executed. When this option is specified along with the –write-recovery-conf (-R) option, primary_slot_name option will be added to the recovery.conf file in the backup destination. In order to use the –slot option, it is required to use –xlog-method = setting of the stream (-Xs) option at the same time.
PDF page 21
PDF page 22
3.2.3 pg_rewind
Pg_rewind command can work when the target timeline changes. This feature is not verified. Please refer to the following URL. http://michael.otacoo.com/postgresql-2/postgres-9-6-feature-highlight-pg-rewind-timeline/
3.2.4 pg_dump / pg_restore
The –strict-names option has been added to the pg_dump command and pg_restore command. In addition, -t option of pg_restore command also match relation other than the normal table. This feature is not verified.
3.2.5 pgbench
Some of the new features in pgbench command has been added, but it does not have to verify.