Skip to content

Commit

Permalink
Merge pull request #174 from matthias-Q/pg_array_function
Browse files Browse the repository at this point in the history
fix: pg `array` function
  • Loading branch information
matthias-Q committed Jul 4, 2023
2 parents 5beeca2 + 6df5ec8 commit 85cbb9e
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 3 deletions.
15 changes: 12 additions & 3 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,18 @@ module.exports = grammar({

array: $ => seq(
$.keyword_array,
"[",
comma_list($._expression),
"]"
choice(
seq(
"[",
comma_list($._expression),
"]"
),
seq(
"(",
$._dml_read,
")",
)
)
),

comment: _ => seq('--', /.*/),
Expand Down
28 changes: 28 additions & 0 deletions test/corpus/select.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2513,6 +2513,34 @@ SELECT array[1, 2, 3 + 4, '5'::int, int_please()];
(object_reference
name: (identifier)))))))))

================================================================================
Select Array with nested dml_read
================================================================================

SELECT ARRAY(SELECT col FROM tab)

--------------------------------------------------------------------------------

(program
(statement
(select
(keyword_select)
(select_expression
(term
(array
(keyword_array)
(select
(keyword_select)
(select_expression
(term
(field
(identifier)))))
(from
(keyword_from)
(relation
(object_reference
(identifier))))))))))

================================================================================
Select with positive and negative integers
================================================================================
Expand Down

0 comments on commit 85cbb9e

Please sign in to comment.