{"record":{"id":"f19f5cf0adb5d246","repo":"apache/cassandra","slug":"range-queries-are-not-supported-please-provide-bo","errorCode":null,"errorMessage":"Range queries are not supported. Please provide both a keyspace and a table name.","messagePattern":"Range queries are not supported\\. Please provide both a keyspace and a table name\\.","errorType":"validation","errorClass":"InvalidRequestException","httpStatus":null,"severity":"error","filePath":"src/java/org/apache/cassandra/db/virtual/PartitionKeyStatsTable.java","lineNumber":352,"sourceCode":"        }\n        return Bounds.bounds(startToken.minKeyBound(), true, endToken.maxKeyBound(), true);\n    }\n\n    private static Cell<?> cell(ColumnMetadata column, ByteBuffer value)\n    {\n        return BufferCell.live(column, 1L, value);\n    }\n\n    @Override\n    public TableMetadata metadata()\n    {\n        return this.metadata;\n    }\n\n    @Override\n    public UnfilteredPartitionIterator select(DataRange dataRange, ColumnFilter columnFilter, RowFilter rowFilter, DataLimits limits)\n    {\n        throw new InvalidRequestException(UNSUPPORTED_RANGE_QUERY_ERROR);\n    }\n\n    @Override\n    public void truncate()\n    {\n        throw new InvalidRequestException(TABLE_READ_ONLY_ERROR);\n    }\n\n    @Override\n    public void apply(PartitionUpdate update)\n    {\n        throw new InvalidRequestException(TABLE_READ_ONLY_ERROR);\n    }\n}\n","sourceCodeStart":334,"sourceCodeEnd":367,"githubUrl":"https://github.com/apache/cassandra/blob/88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1/src/java/org/apache/cassandra/db/virtual/PartitionKeyStatsTable.java#L334-L367","documentation":"The system_views.partitions virtual table requires a fully specified keyspace and table partition; arbitrary range scans are not implemented. The DataRange-based select() overload unconditionally throws InvalidRequestException with UNSUPPORTED_RANGE_QUERY_ERROR.","triggerScenarios":"Querying system_views.partitions without both keyspace_name and table_name equality restrictions, e.g. `SELECT * FROM system_views.partitions;` or filtering only by token.","commonSituations":"Exploratory queries without WHERE clauses; dashboards listing all partitions; drivers issuing unrestricted scans over virtual tables.","solutions":["Always include equality predicates: `WHERE keyspace_name = 'ks' AND table_name = 't'`.","To enumerate tables, query system_schema.tables first, then query partitions per table.","Restrict further with token(...) bounds or key = for specific partitions."],"exampleFix":"// before\nSELECT * FROM system_views.partitions;\n// after\nSELECT * FROM system_views.partitions WHERE keyspace_name = 'ks' AND table_name = 'tbl';","handlingStrategy":"validation","validationCode":"// Require both equality predicates before querying the partitions virtual table\nif (keyspaceName == null || tableName == null)\n    throw new IllegalArgumentException(\"keyspace_name and table_name are required for system_views.partitions\");","typeGuard":null,"tryCatchPattern":"try { rs = session.execute(query); }\ncatch (com.datastax.oss.driver.api.core.servererrors.InvalidQueryException e) {\n    if (e.getMessage().contains(\"Range queries are not supported\")) { /* add keyspace/table predicates and retry */ }\n    else throw e;\n}","preventionTips":["Always filter system_views.partitions by keyspace_name AND table_name equality.","Enumerate tables via system_schema.tables first, then query per table.","Never issue unbounded SELECTs against virtual tables."],"tags":["cassandra","virtual-table","query","range-scan"],"backgroundTag":"unsupported-operation","analyzedSha":"88fd0f6a0eaed8943f05ac9e8f947882b8ddc8f1","analyzedAt":"2026-09-10T07:29:22.284Z","contentChangedAt":"2026-09-10T07:29:22.284Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}