Skip to content

?fields should support fully-qualifying #285

@svix-jbrown

Description

@svix-jbrown

Use case

Using ?fields with joins doesn't work if the same column name (e.g., id) occurs in multiple tables, because ?fields expands to non-qualified names, so the query fails with ambiguous identifier 'id'

client.query("SELECT ?fields FROM table1 JOIN table2 ON table1.foo = table2.bar")
   .fetch_all()
   .await?;

### Describe the solution you'd like

some kind of API to tell clickhouse how to fully-qualify `?fields`. Maybe something like

client.query("SELECT ?fields ...")
.with_fields_qualified_by("table1")
.fetch_all()


### Describe the alternatives you've considered

For now I'm just writing out the fields by hand by reading `Self::COLUMN_NAMES` in a loop, but because none of the clickhouse escaping functions are public this is kind of unsafe and dumb

### Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions