{"record":{"id":"206584dbd1389fe1","repo":"apache/cassandra","slug":"partition-deletion-is-not-supported-by-table-s","errorCode":null,"errorMessage":"Partition deletion is not supported by table %s","messagePattern":"Partition deletion is not supported by table (.+?)","errorType":"exception","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/virtual/AbstractMutableLazyVirtualTable.java","lineNumber":60,"sourceCode":" * modification via INSERT/UPDATE, DELETE and TRUNCATE operations.\n * \n * Virtual table implementation need to be thread-safe has they can be called from different threads.\n */\npublic abstract class AbstractMutableLazyVirtualTable extends AbstractLazyVirtualTable\n{\n    protected AbstractMutableLazyVirtualTable(TableMetadata metadata, OnTimeout onTimeout, Sorted sorted)\n    {\n        super(metadata, onTimeout, sorted);\n    }\n\n    protected AbstractMutableLazyVirtualTable(TableMetadata metadata, OnTimeout onTimeout, Sorted sorted, Sorted sortedByPartitionKey)\n    {\n        super(metadata, onTimeout, sorted, sortedByPartitionKey);\n    }\n\n    protected void applyPartitionDeletion(Object[] partitionKeys)\n    {\n        throw invalidRequest(\"Partition deletion is not supported by table %s\", metadata());\n    }\n\n    protected void applyRangeTombstone(Object[] partitionKey, Object[] start, boolean startInclusive, Object[] end, boolean endInclusive)\n    {\n        throw invalidRequest(\"Range deletion is not supported by table %s\", metadata());\n    }\n\n    protected void applyRowDeletion(Object[] partitionKey, @Nullable Object[] clusteringKeys)\n    {\n        throw invalidRequest(\"Row deletion is not supported by table %s\", metadata());\n    }\n\n    protected void applyRowUpdate(Object[] partitionKeys, @Nullable Object[] clusteringKeys, ColumnMetadata[] columns, Object[] values)\n    {\n        throw invalidRequest(\"Column modification is not supported by table %s\", metadata());\n    }\n\n    private void applyRangeTombstone(Object[] pks, RangeTombstone rt)","sourceCodeStart":42,"sourceCodeEnd":78,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/virtual/AbstractMutableLazyVirtualTable.java#L42-L78","documentation":"AbstractMutableLazyVirtualTable lets concrete virtual tables opt into which mutations they support. The default applyPartitionDeletion implementation throws this invalid-request error because the table did not override it, meaning DELETE of entire partitions is not supported by that virtual table.","triggerScenarios":"Executing 'DELETE FROM <virtual_table> WHERE <full partition key>' (or an equivalent mutation via the driver) against a virtual table whose implementation does not override applyPartitionDeletion(Object[]).","commonSituations":"Users treating system virtual tables (system_views.*, etc.) like normal tables and issuing full-partition DELETEs; cleanup scripts attempting to purge virtual-table rows by partition.","solutions":["Delete individual rows instead of the whole partition (row deletion may be supported).","Use SELECT filtering rather than deleting; virtual tables are views over runtime state and often cannot be mutated.","If you own the virtual table implementation, override applyPartitionDeletion to implement the deletion.","Stop/adjust the underlying state that the partition reflects (e.g. reset the metric or operation) instead of deleting rows."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n    session.execute(\"DELETE FROM system_views.some_table WHERE pk = ?\", pk);\n} catch (InvalidQueryException e) {\n    if (e.getMessage().contains(\"Partition deletion is not supported\")) {\n        // fall back to row-level deletes or manage underlying state instead\n    }\n}","preventionTips":["Treat virtual tables as read-mostly; check documentation before issuing DELETE/UPDATE.","Prefer row-level deletes over partition deletes when mutating virtual tables.","Fix the underlying runtime state rather than deleting the rows that reflect it."],"tags":["virtual-tables","cql","delete"],"backgroundTag":"unsupported-operation","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}