Skip to content

500: unknown field or tag name in select clause: field2 #2125

Closed
@dashesy

Description

When performing a query like SELECT field1, field2 from some_measurement if one of the fields (e.g. field2) does not exist yet it returns an error

500: unknown field or tag name in select clause: field2

This is a sensible approach for normal dbs, but makes the design less schema-less! because I may not know beforehand what fields exist, unless reading SHOW FIELD KEYS first which requires 2 trips to the database. It would be useful to let it return nothing (maybe with SELECT field1,optional(field2) or through a ignore_unknown_fields url param or making it default).

The rationale is that field2 may not occur as frequently (it could be alien_spaceship_observed), so it may not have any values yet; if it does not exist it would be equivalent to when it does not occur in a given time span. If there is no value for field2 in t1 to t2 a query like SELECT field1, field2 from some_measurement WHERE time >= t0 and time <= t1 will not return an error, but simply will not populate field2, so it makes sense to expect the same when no field2 has yet been added to the index.

Even making it the default behavior will not be bad IMO, because if it does not exist it will not show up in names in the returned results, and user herself can raise an exception if the value is critical.

Please let me know if I am mistaken, or simply there is a better way, this will change how I will have to deal with missing values. Similar issue is also for GROUP BY field2.

If I know this behavior is going to remain I will have to make a fixture with some dummy values that will initialize the database and makes sure these fields exist.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions