influxdata / influxdata/influxdb

Support `system.tables` queries when scoped to a database

Open
#27,205 1 comment 0 reactions 0 assignees View on GitHub
v3
Dominant language
Rust
Stars
31.7k
Forks
3.7k
Avg merge
13h 37m
Merged PRs (30d)
8

Description

### Problem

The `system.tables` table can only be queried on the `_internal` database, e.g.,
```
influxdb3 query --database _internal "select * from system.tables where database_name = ''"
```
but not,
```
influxdb3 query --database "select * from system.tables"
```

### Proposed solution

- Allow `system.tables` to be queried when scoped to a database, as in the above example.
- Only tables from within the scoped database should be returned in the query results.

### Additional context

You can see where the `tables` system table is currently being added to the `SystemTablesProvider` here:
https://github.com/influxdata/influxdb/blob/9fe5b77c382ab9fe5228559689032e907fa5f35f/influxdb3_system_tables/src/lib.rs#L205-L210
But that is only when the query is against the `_internal` database.

Contributor guide

Open the contributing guide

Research direction

Start in influxdb3_system_tables/src/lib.rs around the SystemTablesProvider setup referenced in the issue, then trace how queries scoped to a database select system tables. Update the behavior so system.tables is available for a scoped database and returns only that database's tables; add or run the relevant query coverage if the surrounding code identifies it.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
databases
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.