Skip to content

Truncated attribute names #1274

@ValentinKaisermayer

Description

@ValentinKaisermayer

I have a query with a very long column name:

SELECT
    time,
    ROUND(MAX(CASE WHEN sensor_id = 'In1I21BK1_H922_S92_A01_BKAZonenventilH_K_K1_outStatusTrajVorgabe' THEN value END)::NUMERIC, 2) AS "In1I21BK1_H922_S92_A01_BKAZonenventilH_K_K1_outStatusTrajVorgabe"
FROM (
    SELECT
        sensor_id,
        date_trunc('second', time) - (EXTRACT(EPOCH FROM time)::integer % $1) * interval '1 second' AS time,
        ROUND(avg(value)::NUMERIC, 2) as value
    FROM measurements
    WHERE sensor_id = ANY(ARRAY['In1I21BK1_H922_S92_A01_BKAZonenventilH_K_K1_outStatusTrajVorgabe'])
    AND time BETWEEN $2 AND $3
    GROUP BY time, sensor_id
) subquery
GROUP BY time
ORDER BY time ASC
stmt = await con.prepare(query)
columns = [a.name for a in stmt.get_attributes()]
print(columns)
# yields ['time', 'In1I21BK1_H922_S92_A01_BKAZonenventilH_K_K1_outStatusTrajVorgab']

Notice the missing e at the end.
It is not a db issue, since the query runs fine when using, e.g. SQLTools.
Is there some limit imposed on the attribute name length?

Metadata

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