-
Notifications
You must be signed in to change notification settings - Fork 55
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
What happened?
with stanza as (
select
data -> 'name' as name,
data -> 'backup' -> (
jsonb_array_length(data -> 'backup') - 1
) as last_backup,
data -> 'archive' -> (
jsonb_array_length(data -> 'archive') - 1
) as current_archive
from jsonb_array_elements(monitor.pgbackrest_info()) as data
)
select
name,
to_timestamp(
(last_backup -> 'timestamp' ->> 'stop')::numeric
) as last_successful_backup,
current_archive ->> 'max' as last_archived_wal
from stanza;Expected: No error - data alias is used in data -> 'name'
Actual:
sqruff auto fix removes as data inside from jsonb_array_elements(monitor.pgbackrest_info()) as data
FAIL
L: 13 | P: 61 | AL05 | Alias 'data' is never used in SELECT statement.
| [aliasing.unused]However, it should not.
Seems qruff does not parse PostgreSQL JSON operators (->, ->>) as identifier references.
Version
0.34.1
Checked in Playground
- I have checked this bug in the playground.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working