ClickHouse / ClickHouse/clickhouse-rs

Create a version of `Identifier` that handles qualified identifiers

Open
#286 1 comment 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
559
Forks
172
Avg merge
1d 19h
Merged PRs (30d)
3

Description

### Use case

We often want to refer to qualified identifiers (e.g., `table.column`). Right now, the `Identifier` type only handles a single level of identifiers. As far as I know, Clickhouse only supports two levels of nesting (there are no schemas or other objects that would require quoting `foo.bar.baz`); however, it is perfectly legal for an Identifier to include a `.` character.

### Describe the solution you'd like

A new type

```rust
pub struct ScopedIdentifier<'a, 'b>(pub &'a str, pub &'b str)
```

This should serialize as follows:

```rust
ScopedIdentifier('foo', 'bar') -> `foo`.`bar`
ScopedIdentifier('', 'bar') -> `bar`
ScopedIdentifier('foo', '') -> `foo`.``
```

### Describe the alternatives you've considered

Right now I'm doing this in my own query generation with `format!()` and it's bad.

### Additional context

Contributor guide

Open the contributing guide

Research direction

Search the existing `Identifier` type and its serialization implementation, then inspect nearby tests or query-generation code. Add the requested `ScopedIdentifier` behavior for qualified and empty components, and verify the serialized forms match the examples in the issue.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.