Skip to content

Arrayslice support for postgresql #73

@pantonis

Description

@pantonis

I have this query

SELECT
    ARRAY_TO_STRING(
        (ARRAY_AGG("EmployeeName" ORDER BY "Salary" DESC))[1:10],
        ', '
    ) AS top10_employees,
    ARRAY_TO_STRING(
        (ARRAY_AGG("EmployeeName" ORDER BY "Salary" ASC))[1:10],
        ', '
    ) AS bottom10_employees
FROM
    "Employee";

but the parser fails to parse it correctly when I try to convert it back to sql I get

SELECT
        ARRAY_TO_STRING((ARRAY_AGG("EmployeeName" ORDER BY "Salary" DESC))
		[LiteralValue { Value = Number { Value = 1, Long = False } }:LiteralValue { Value = Number { Value = 10, Long = False } }], ', ') AS top10_employees,
        ARRAY_TO_STRING((ARRAY_AGG("EmployeeName" ORDER BY "Salary" ASC))
		[LiteralValue { Value  = Number { Value = 1, Long = False } }:LiteralValue { Value = Number { Value = 10, Long = False } }], ', ') AS bottom10_employees
FROM
        Employee

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions