Vertica Analytics Platform Version 9.2.x Documentation

Command-Line Options

This section contains the command-line options for vsql.

General Options

Option Description
‑‑command command
‑c command

Runs one command and exits. This command is useful in shell scripts.

‑‑dbname dbname
‑d dbname

Specifies the name of the database to which you want to connect. Using this command is equivalent to specifying dbname as the first non-option argument on the command line.

‑‑file filename
‑f filename

Uses the filename as the source of commands instead of reading commands interactively. After the file is processed, vsql terminates.

‑‑help

Displays help about vsql command line arguments and exits.

‑‑timing
‑i
Enables the \timing meta-command.
‑‑list
‑l

Returns all available databases, then exits. Other non-connection options are ignored. This command is similar to the internal command \list.

‑‑set assignment
‑‑variable assignment
‑v assignment

Performs a variable assignment, like the vsql command\set.

‑‑version
‑V

Prints the vsql version and exits.

‑‑no‑vsqlr
‑X

Disables all command line editing and history functionality.

Connection Options

Option Description
‑4

When resolving hostnames in dual stack environments, prefer IPv4 addresses.

‑6

When resolving hostnames in dual stack environments, prefer IPv6 addresses.

‑B server:port[,...]

Sets connection backup server/port. Use comma-separated multiple hosts (default: not set). If using an IPv6 address, enclose the address in brackets ([, ]) and place the port outside of the brackets. For example \B [2620:0:a13:8a4:9d9f:e0e3:1181:7f51]:5433

‑‑enable‑connection
‑load‑balance ‑C

Enables connection load balancing (default: not enabled).

You can only use load balancing with one address family in dual stack environments. For example, if you've configured load balancing for IPv6 addresses, then when an IPv4 client connects and requests load balancing the server does not allow it.

‑‑host hostname
‑h hostname

Specifies the host name of the machine on which the server is running.

‑k krb‑service

Provides the service name portion of the Kerberos principal (default: vertica). Using ‑k is equivalent to using the drivers' KerberosServiceName connection string.

‑K krb‑host

Provides the instance or host name portion of the Kerberos principal. ‑K is equivalent to the drivers' KerberosHostName connection string.

‑‑sslmode
‑m

Specifies the policy for making SSL connections to the server. Options are require, prefer, allow, and disable. You can also set the VSQL_SSLMODE variable to achieve the same effect. If the variable is set, the command-line option overrides it.

‑‑port port
‑p port

Specifies the TCP port or the local socket file extension on which the server is listening for connections. Defaults to port 5433.

‑‑username username
‑U username

Connects to the database as the user username instead of the default.

‑w password

Specifies the password for a database user.

Using this command-line option displays the database password in plain text. Use it with care, particularly if you are connecting as the database administrator, to avoid exposing sensitive information.

‑‑password
‑W

Forces vsql to prompt for a password before connecting to a database. The password is not displayed on the screen. This option remains set for the entire session, even if you change the database connection with the meta-command \connect.

Output Formatting

Option Description
‑‑no‑align
‑A

Switches to unaligned output mode. (The default output mode is aligned.)

‑b

Beep on command completion.

‑‑field‑separator separator
‑F separator

Specifies the field separator for unaligned output (default: "|") (‑P fieldsep=). (See ‑A ‑‑no‑align.) Using this command is equivalent to \pset fieldsep or \f.

‑‑html
‑H

Turns on HTML tabular output. Using this command is equivalent to using the \pset format html or the \H command.

‑‑pset assignment
‑P assignment

Lets you specify printing options in the style of \pset on the command line. You must separate the name and value with an equals (=) sign instead of a space. Thus, to set the output format to LaTeX, you could write ‑P format=latex.

‑Q Turns on trailing record separator. Use \pset trailingrecordsep to toggle the trailing record separator on or off.
‑‑record‑separator separator
‑R separator

Uses separator as the record separator. Using this command is equivalent to using the \pset recordsep command.

‑‑tuples‑only
‑t

Disables printing of column names, result row count footers, and so on. This is equivalent to the vsql meta-command \t.

‑‑table‑attr options
‑T options

Allows you to specify options to be placed within the HTML table tag. See \pset for details.

‑‑expanded
‑x

Enables extended table formatting mode. This is equivalent to the vsql meta-command \x.

Input and Output Options

Option Description
‑‑echo‑all
‑a

Prints all input lines to standard output as they are read. This approach is more useful for script processing than interactive mode. It is the same as setting the variable ECHO to all.

‑‑echo‑queries
‑e

Copies all SQL commands sent to the server to standard output. Using this command is equivalent to setting the variable ECHO to queries.

‑E

Displays queries generated by internal commands.

‑n

Disables command line editing.

‑‑output filename
‑o filename

Writes all query output to filename. Using this command is equivalent to using the vsql meta-command \o.

‑‑quiet
‑q

Specifies that vsql do its work quietly (without informational output, such as welcome messages). This command is useful with the ‑c option. Within vsql you can also set the QUIET variable to achieve the same effect.

‑‑single‑step
‑s

Runs in single-step mode for debugging scripts. Forces vsql to prompt before each statement is sent to the database and allows you to cancel execution.

‑‑single‑line
‑S

Runs in single-line mode where a newline terminates a SQL command, as if you are using a semicolon.

This mode is provided only by customer request. Vertica recommends that you not use single-line mode in cases where you mix SQL and meta-commands on a line. In single-line mode, the order of execution might be unclear to the inexperienced user.