8000 Indentation problems with ARRAY clause after ::timestamp WITH TIMEZONE AS · Issue #811 · andialbrecht/sqlparse · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
Indentation problems with ARRAY clause after ::timestamp WITH TIMEZONE AS #811
Open
@jacobtylerwalls

Description

@jacobtylerwalls

Describe the bug
Excessive indentation occurs around ARRAY subqueries after ::timestamp WITH TIMEZONE AS.

To Reproduce
Format this code (reduced example -- indentation compounds and gets worse)

SELECT * FROM "tiles", 
  ARRAY (
    (
      SELECT * FROM "tiles"
    )
  ):: timestamp WITH TIME ZONE AS "destruction_timespan_end_of_the_end", 
  ARRAY (
    SELECT *
    FROM "tiles"
  ) AS "destruction_statement_language",
sqlparse.format(sql, reindent=True, keyword_case="upper")

Expected behavior
Should format without excessive indentation of ARRAY:

SELECT *
FROM "tiles",
     ARRAY (
              (SELECT *
               FROM "tiles")):: timestamp WITH TIME ZONE AS "destruction_timespan_end_of_the_end",
                                                            ARRAY
  (SELECT *
   FROM "tiles") AS "destruction_statement_language",

Versions (please complete the following information):

  • Python: 3.12.0
  • sqlparse: 0.5.1

Additional context
A longer example (that takes 13s to format) is available here, with more severe indentation problems.

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

      0