Learn R Programming

rpg (version 1.6)

psql: PostgreSQL shell

Description

Run PostgreSQL's psql shell interactively

Usage

psql(psql_opts = "")

Arguments

psql_opts

a character string passed to the psql command

Details

The psql function repeatedly queries for input and pipes it to PostgreSQL's psql command. It will terminate on \q or empty input.

If psql_opts is an empty string, then an attempt will be made to supply suitable options based on the current connection. If there is no active connection, psql will fallback to complied in defaults. If psql_opts is not an empty string, then it will be passed as-is to psql.

You can type psql's escape commands as usual. Try \?. You cannot use \e or \ef to evoke an editor. Doing strange things with \! will likely hang the R session.

There is no way to direclty enter a database password. If one is required, you can use a password file or set_conn_defaults.

Unfortunately it is probably impossible to enable GNU readline support so for example up-arrow will recall your R commands, not the psql commands entered. You can always call psql from a terminal.

See Also

set_default_password