Skip to content

Create a version of Identifier that handles qualified identifiers #286

@svix-jbrown

Description

@svix-jbrown

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

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

This should serialize as follows:

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions