grafana / grafana/grafana-postgresql-datasource

VQB: Selected columns under ORDER BY should return index instead of value for calculated fields

Open
#145 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
2
Forks
8
Avg merge
1d 21h
Merged PRs (30d)
5

Description

### What happened?

Image

### What did you expect to happen?

Selecting calculated fields like `$__timeGroupAlias` should result as an index instead.

### Did this work before?

Way back then.

### How do we reproduce it?

1. Open Explore with PostgreSQL as a data source
2. Create a time series query with `$__timeGroupAlias` macro
3. Select the first selected column from the `ORDER BY` drop down
4. Inspect the query preview that the whole `$__timeGroupAlias` is added instead of `1`

### Is the bug inside a dashboard panel?

_No response_

### Environment (with versions)?

Grafana:
OS:
Browser:

### Grafana platform?

I use Grafana Cloud

### Datasource(s)?

_No response_

Contributor guide

Open the contributing guide

Research direction

No source file or test is named. Reproduce the issue in Grafana Explore with PostgreSQL by using a time series query containing $__timeGroupAlias, selecting the first selected column in the ORDER BY dropdown, and inspecting the query preview. Done means the preview uses the selected column's index, such as 1, rather than expanding the calculated field.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, postgresql
Domain
database
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.