Learn R Programming

rpostgis (version 1.0.0)

dbDrop: Drop table/view/schema.

Description

Drop a table, a view or a schema.

Usage

dbDrop(conn, name, type = c("table", "view", "schema"), ifexists = FALSE, cascade = FALSE, display = TRUE, exec = TRUE)

Arguments

conn
A connection object.
name
A character string specifying a PostgreSQL table, view or schema name.
type
The type of the object to comment, either table or view
ifexists
Do not throw an error if the table does not exist. A notice is issued in this case.
cascade
Automatically drop objects that depend on the table (such as views).
display
Logical. Whether to display the query (defaults to TRUE).
exec
Logical. Whether to execute the query (defaults to TRUE).

Value

TRUE if the table/view/schema was successfully dropped.

See Also

The PostgreSQL documentation: http://www.postgresql.org/docs/current/static/sql-droptable.html, http://www.postgresql.org/docs/current/static/sql-dropview.html, http://www.postgresql.org/docs/current/static/sql-dropschema.html

Examples

Run this code
## examples use a dummy connection from DBI package
conn<-DBI::ANSI()
dbDrop(conn, name = c("fla", "bli"), type = "view", exec = FALSE)
dbDrop(conn, name = "fla", type = "schema", cascade = "TRUE", exec = FALSE)

Run the code above in your browser using DataLab