openGauss icon

openGauss

Get, add and update data in openGauss

Database → Delete

AI-generated

Summary

Delete rows or drop/truncate a table in openGauss

Inputs

  • schema (required) — Schema containing the target table (default: public).
  • table (required) — Name of the table to operate on.
  • deleteCommand (required) — Delete mode: 'truncate' (preserve structure), 'delete' (row filtering), or 'drop' (remove table).
  • restartSequences — Reset identity columns when using 'truncate' mode.
  • where — Array of condition objects to filter rows for 'delete' mode; omitted to delete all rows.
  • combineConditions — Logical operator ('AND' or 'OR') to combine multiple conditions in 'delete' mode.
  • options — Additional settings such as cascade, query parameters, output columns, or skip on conflict.

Output shape

Array of result objects; success payloads include success and affectedRows, failure payloads include error.

Output order matches input items; missing fields indicate failure.

Examples

Example 1: Delete all rows from a table

Schema=public, Table=users, Command=delete

Example 2: Drop a table with dependent objects

Schema=app, Table=legacy_data, Command=drop, Options.Cascade=true

Example 3: Truncate a table and reset sequences

Schema=public, Table=logs, Command=truncate, Restart Sequences=true

Links

Discussion