TRUNCATE {pgTools}R Documentation

Generate a PostgreSQL TRUNCATE statement, optionally execute the statement if con is not NULL.

Description

Generate a PostgreSQL TRUNCATE statement, optionally execute the statement if con is not NULL.

Usage

TRUNCATE(
  schema = NULL,
  table,
  restart_identity = FALSE,
  continue_identity = FALSE,
  cascade = FALSE,
  restrict = FALSE,
  con = NULL
)

Arguments

schema

A string, the schema name of the SQL table to TRUNCATE.

table

A string, the table name of the SQL table to TRUNCATE.

restart_identity

TRUE/FALSE, if TRUE, will add RESTART IDENTITY to the statement.

continue_identity

TRUE/FALSE, if TRUE, will add CONTINUE IDENTITY to the statement.

cascade

TRUE/FALSE, if TRUE, will add CASCADE to the statement.

restrict

TRUE/FALSE, if TRUE, will add RESTRICT to the statement.

con

A database connection that can be passed to DBI::dbSendQuery/DBI::dbGetQuery.

Value

A string, PostgreSQL DELETE statement; or the results retrieved by DBI::dbGetQuery after executing the statement.

Examples

TRUNCATE(
schema = "test",
table = "table1"
)

[Package pgTools version 1.0.2 Index]