Skip to content

Commit

Permalink
Resolve #24: Support COLLATE option
Browse files Browse the repository at this point in the history
  • Loading branch information
takegue committed May 5, 2023
1 parent ccd9640 commit 2937fa3
Show file tree
Hide file tree
Showing 5 changed files with 531,966 additions and 524,419 deletions.
6 changes: 6 additions & 0 deletions grammar.js
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ module.exports = grammar({
kw('CREATE SCHEMA'),
optional($.keyword_if_not_exists),
field('schema_name', $.identifier),
optional($.default_collate_clause),
optional($.option_clause),
),
alter_schema_statement: ($) =>
Expand Down Expand Up @@ -358,6 +359,7 @@ module.exports = grammar({
optional($.keyword_if_not_exists),
field('table_name', $.identifier),
optional($.create_table_parameters),
optional($.default_collate_clause),
optional($.table_partition_clause),
optional($.table_cluster_clause),
optional($.option_clause),
Expand Down Expand Up @@ -408,6 +410,7 @@ module.exports = grammar({
optional($.option_clause),
),
),
default_collate_clause: ($) => seq(kw('DEFAULT COLLATE'), $.string),
copy_clause: ($) => seq(kw('COPY'), field('source_table_name', $.identifier)),
create_snapshot_table_statement: ($) =>
prec.right(seq(
Expand Down Expand Up @@ -537,9 +540,12 @@ module.exports = grammar({
seq(
field('column_name', $.identifier),
field('column_type', $.column_type),
optional(field('collate_clause', $.collate_clause)),
optional(field('default', $.default_clause)),
optional(field('option', $.option_clause)),
),

collate_clause: ($) => prec.left(seq(kw('COLLATE'), $.string)),
column_type: ($) =>
choice(
prec(1, seq($._unquoted_identifier, '(', commaSep1($.number), ')')),
Expand Down
Loading

0 comments on commit 2937fa3

Please sign in to comment.