Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: various errors #138

Merged
merged 4 commits into from
Apr 20, 2023
Merged

fix: various errors #138

merged 4 commits into from
Apr 20, 2023

Conversation

DerekStride
Copy link
Owner

What

fixes #137

This PR adds fixes for all the parse errors from the file in #137 & nvim-treesitter/nvim-treesitter#4668.

Integration test: tree-sitter parse tmp/issue_137.sql
➜ tree-sitter-sql tree-sitter parse tmp/issue_137.sql | rg ERROR
➜ tree-sitter-sql tree-sitter parse tmp/issue_137.sql
(program [0, 0] - [63, 0]
  (statement [0, 0] - [3, 2]
    (create_table [0, 0] - [3, 1]
      (keyword_create [0, 0] - [0, 6])
      (keyword_table [0, 7] - [0, 12])
      (table_reference [0, 13] - [0, 19]
        name: (identifier [0, 13] - [0, 19]))
      (column_definitions [0, 20] - [3, 1]
        (column_definition [1, 2] - [1, 46]
          name: (identifier [1, 2] - [1, 10])
          type: (bigint [1, 11] - [1, 17]
            (keyword_bigint [1, 11] - [1, 17]))
          (keyword_generated [1, 18] - [1, 27])
          (keyword_always [1, 28] - [1, 34])
          (keyword_as [1, 35] - [1, 37])
          (identifier [1, 38] - [1, 46]))
        (column_definition [2, 2] - [2, 25]
          name: (identifier [2, 2] - [2, 8])
          type: (varchar [2, 9] - [2, 16]
            (keyword_varchar [2, 9] - [2, 16]))
          (keyword_not [2, 17] - [2, 20])
          (keyword_null [2, 21] - [2, 25])))))
  (statement [5, 0] - [5, 66]
    (alter_table [5, 0] - [5, 65]
      (keyword_alter [5, 0] - [5, 5])
      (keyword_table [5, 6] - [5, 11])
      (table_reference [5, 12] - [5, 18]
        name: (identifier [5, 12] - [5, 18]))
      (add_constraint [5, 19] - [5, 65]
        (keyword_add [5, 19] - [5, 22])
        (keyword_constraint [5, 23] - [5, 33])
        (field [5, 34] - [5, 42]
          name: (identifier [5, 34] - [5, 42]))
        (constraint [5, 43] - [5, 65]
          (keyword_primary [5, 43] - [5, 50])
          (keyword_key [5, 51] - [5, 54])
          (ordered_columns [5, 55] - [5, 65]
            (column [5, 56] - [5, 64]
              name: (identifier [5, 56] - [5, 64])))))))
  (statement [6, 0] - [6, 52]
    (create_index [6, 0] - [6, 51]
      (keyword_create [6, 0] - [6, 6])
      (keyword_unique [6, 7] - [6, 13])
      (keyword_index [6, 14] - [6, 19])
      (literal [6, 20] - [6, 32])
      (keyword_on [6, 33] - [6, 35])
      (table_reference [6, 36] - [6, 42]
        name: (identifier [6, 36] - [6, 42]))
      (ordered_columns [6, 43] - [6, 51]
        (column [6, 44] - [6, 50]
          name: (identifier [6, 44] - [6, 50])))))
  (statement [7, 0] - [11, 2]
    (create_table [7, 0] - [11, 1]
      (keyword_create [7, 0] - [7, 6])
      (keyword_table [7, 7] - [7, 12])
      (table_reference [7, 13] - [7, 22]
        name: (identifier [7, 13] - [7, 22]))
      (column_definitions [7, 23] - [11, 1]
        (column_definition [8, 2] - [8, 49]
          name: (identifier [8, 2] - [8, 13])
          type: (bigint [8, 14] - [8, 20]
            (keyword_bigint [8, 14] - [8, 20]))
          (keyword_generated [8, 21] - [8, 30])
          (keyword_always [8, 31] - [8, 37])
          (keyword_as [8, 38] - [8, 40])
          (identifier [8, 41] - [8, 49]))
        (column_definition [9, 2] - [9, 30]
          name: (identifier [9, 2] - [9, 9])
          type: (varchar [9, 10] - [9, 21]
            (keyword_varchar [9, 10] - [9, 17])
            size: (literal [9, 18] - [9, 20]))
          (keyword_not [9, 22] - [9, 25])
          (keyword_null [9, 26] - [9, 30]))
        (column_definition [10, 2] - [10, 29]
          name: (identifier [10, 2] - [10, 12])
          type: (varchar [10, 13] - [10, 20]
            (keyword_varchar [10, 13] - [10, 20]))
          (keyword_not [10, 21] - [10, 24])
          (keyword_null [10, 25] - [10, 29])))))
  (statement [13, 0] - [13, 75]
    (alter_table [13, 0] - [13, 74]
      (keyword_alter [13, 0] - [13, 5])
      (keyword_table [13, 6] - [13, 11])
      (table_reference [13, 12] - [13, 21]
        name: (identifier [13, 12] - [13, 21]))
      (add_constraint [13, 22] - [13, 74]
        (keyword_add [13, 22] - [13, 25])
        (keyword_constraint [13, 26] - [13, 36])
        (field [13, 37] - [13, 48]
          name: (identifier [13, 37] - [13, 48]))
        (constraint [13, 49] - [13, 74]
          (keyword_primary [13, 49] - [13, 56])
          (keyword_key [13, 57] - [13, 60])
          (ordered_columns [13, 61] - [13, 74]
            (column [13, 62] - [13, 73]
              name: (identifier [13, 62] - [13, 73])))))))
  (statement [14, 0] - [14, 60]
    (create_index [14, 0] - [14, 59]
      (keyword_create [14, 0] - [14, 6])
      (keyword_unique [14, 7] - [14, 13])
      (keyword_index [14, 14] - [14, 19])
      (literal [14, 20] - [14, 36])
      (keyword_on [14, 37] - [14, 39])
      (table_reference [14, 40] - [14, 49]
        name: (identifier [14, 40] - [14, 49]))
      (ordered_columns [14, 50] - [14, 59]
        (column [14, 51] - [14, 58]
          name: (identifier [14, 51] - [14, 58])))))
  (statement [16, 0] - [19, 2]
    (create_table [16, 0] - [19, 1]
      (keyword_create [16, 0] - [16, 6])
      (keyword_table [16, 7] - [16, 12])
      (table_reference [16, 13] - [16, 26]
        name: (identifier [16, 13] - [16, 26]))
      (column_definitions [16, 27] - [19, 1]
        (column_definition [17, 2] - [17, 29]
          name: (identifier [17, 2] - [17, 13])
          type: (bigint [17, 14] - [17, 20]
            (keyword_bigint [17, 14] - [17, 20]))
          (keyword_not [17, 21] - [17, 24])
          (keyword_null [17, 25] - [17, 29]))
        (column_definition [18, 2] - [18, 26]
          name: (identifier [18, 2] - [18, 10])
          type: (bigint [18, 11] - [18, 17]
            (keyword_bigint [18, 11] - [18, 17]))
          (keyword_not [18, 18] - [18, 21])
          (keyword_null [18, 22] - [18, 26])))))
  (statement [21, 0] - [21, 93]
    (alter_table [21, 0] - [21, 92]
      (keyword_alter [21, 0] - [21, 5])
      (keyword_table [21, 6] - [21, 11])
      (table_reference [21, 12] - [21, 25]
        name: (identifier [21, 12] - [21, 25]))
      (add_constraint [21, 26] - [21, 92]
        (keyword_add [21, 26] - [21, 29])
        (keyword_constraint [21, 30] - [21, 40])
        (field [21, 41] - [21, 56]
          name: (identifier [21, 41] - [21, 56]))
        (constraint [21, 57] - [21, 92]
          (keyword_primary [21, 57] - [21, 64])
          (keyword_key [21, 65] - [21, 68])
          (ordered_columns [21, 69] - [21, 92]
            (column [21, 70] - [21, 81]
              name: (identifier [21, 70] - [21, 81]))
            (column [21, 83] - [21, 91]
              name: (identifier [21, 83] - [21, 91])))))))
  (statement [22, 0] - [22, 143]
    (alter_table [22, 0] - [22, 142]
      (keyword_alter [22, 0] - [22, 5])
      (keyword_table [22, 6] - [22, 11])
      (table_reference [22, 12] - [22, 25]
        name: (identifier [22, 12] - [22, 25]))
      (add_constraint [22, 26] - [22, 142]
        (keyword_add [22, 26] - [22, 29])
        (keyword_constraint [22, 30] - [22, 40])
        (field [22, 41] - [22, 63]
          name: (identifier [22, 41] - [22, 63]))
        (constraint [22, 64] - [22, 142]
          (keyword_foreign [22, 64] - [22, 71])
          (keyword_key [22, 72] - [22, 75])
          (ordered_columns [22, 76] - [22, 89]
            (column [22, 77] - [22, 88]
              name: (identifier [22, 77] - [22, 88])))
          (keyword_references [22, 90] - [22, 100])
          (table_reference [22, 101] - [22, 110]
            name: (identifier [22, 101] - [22, 110]))
          (ordered_columns [22, 111] - [22, 124]
            (column [22, 112] - [22, 123]
              name: (identifier [22, 112] - [22, 123])))
          (keyword_on [22, 125] - [22, 127])
          (keyword_delete [22, 128] - [22, 134])
          (keyword_cascade [22, 135] - [22, 142])))))
  (statement [23, 0] - [23, 131]
    (alter_table [23, 0] - [23, 130]
      (keyword_alter [23, 0] - [23, 5])
      (keyword_table [23, 6] - [23, 11])
      (table_reference [23, 12] - [23, 25]
        name: (identifier [23, 12] - [23, 25]))
      (add_constraint [23, 26] - [23, 130]
        (keyword_add [23, 26] - [23, 29])
        (keyword_constraint [23, 30] - [23, 40])
        (field [23, 41] - [23, 60]
          name: (identifier [23, 41] - [23, 60]))
        (constraint [23, 61] - [23, 130]
          (keyword_foreign [23, 61] - [23, 68])
          (keyword_key [23, 69] - [23, 72])
          (ordered_columns [23, 73] - [23, 83]
            (column [23, 74] - [23, 82]
              name: (identifier [23, 74] - [23, 82])))
          (keyword_references [23, 84] - [23, 94])
          (table_reference [23, 95] - [23, 101]
            name: (identifier [23, 95] - [23, 101]))
          (ordered_columns [23, 102] - [23, 112]
            (column [23, 103] - [23, 111]
              name: (identifier [23, 103] - [23, 111])))
          (keyword_on [23, 113] - [23, 115])
          (keyword_delete [23, 116] - [23, 122])
          (keyword_cascade [23, 123] - [23, 130])))))
  (statement [24, 0] - [28, 2]
    (create_table [24, 0] - [28, 1]
      (keyword_create [24, 0] - [24, 6])
      (keyword_table [24, 7] - [24, 12])
      (table_reference [24, 13] - [24, 19]
        name: (identifier [24, 13] - [24, 19]))
      (column_definitions [24, 20] - [28, 1]
        (column_definition [25, 2] - [25, 46]
          name: (identifier [25, 2] - [25, 10])
          type: (bigint [25, 11] - [25, 17]
            (keyword_bigint [25, 11] - [25, 17]))
          (keyword_generated [25, 18] - [25, 27])
          (keyword_always [25, 28] - [25, 34])
          (keyword_as [25, 35] - [25, 37])
          (identifier [25, 38] - [25, 46]))
        (column_definition [26, 2] - [26, 25]
          name: (identifier [26, 2] - [26, 8])
          type: (varchar [26, 9] - [26, 16]
            (keyword_varchar [26, 9] - [26, 16]))
          (keyword_not [26, 17] - [26, 20])
          (keyword_null [26, 21] - [26, 25]))
        (column_definition [27, 2] - [27, 27]
          name: (identifier [27, 2] - [27, 11])
          type: (bigint [27, 12] - [27, 18]
            (keyword_bigint [27, 12] - [27, 18]))
          (keyword_not [27, 19] - [27, 22])
          (keyword_null [27, 23] - [27, 27])))))
  (statement [30, 0] - [30, 66]
    (alter_table [30, 0] - [30, 65]
      (keyword_alter [30, 0] - [30, 5])
      (keyword_table [30, 6] - [30, 11])
      (table_reference [30, 12] - [30, 18]
        name: (identifier [30, 12] - [30, 18]))
      (add_constraint [30, 19] - [30, 65]
        (keyword_add [30, 19] - [30, 22])
        (keyword_constraint [30, 23] - [30, 33])
        (field [30, 34] - [30, 42]
          name: (identifier [30, 34] - [30, 42]))
        (constraint [30, 43] - [30, 65]
          (keyword_primary [30, 43] - [30, 50])
          (keyword_key [30, 51] - [30, 54])
          (ordered_columns [30, 55] - [30, 65]
            (column [30, 56] - [30, 64]
              name: (identifier [30, 56] - [30, 64])))))))
  (statement [31, 0] - [31, 52]
    (create_index [31, 0] - [31, 51]
      (keyword_create [31, 0] - [31, 6])
      (keyword_unique [31, 7] - [31, 13])
      (keyword_index [31, 14] - [31, 19])
      (literal [31, 20] - [31, 32])
      (keyword_on [31, 33] - [31, 35])
      (table_reference [31, 36] - [31, 42]
        name: (identifier [31, 36] - [31, 42]))
      (ordered_columns [31, 43] - [31, 51]
        (column [31, 44] - [31, 50]
          name: (identifier [31, 44] - [31, 50])))))
  (statement [32, 0] - [32, 107]
    (alter_table [32, 0] - [32, 106]
      (keyword_alter [32, 0] - [32, 5])
      (keyword_table [32, 6] - [32, 11])
      (table_reference [32, 12] - [32, 18]
        name: (identifier [32, 12] - [32, 18]))
      (add_constraint [32, 19] - [32, 106]
        (keyword_add [32, 19] - [32, 22])
        (keyword_constraint [32, 23] - [32, 33])
        (field [32, 34] - [32, 47]
          name: (identifier [32, 34] - [32, 47]))
        (constraint [32, 48] - [32, 106]
          (keyword_foreign [32, 48] - [32, 55])
          (keyword_key [32, 56] - [32, 59])
          (ordered_columns [32, 60] - [32, 71]
            (column [32, 61] - [32, 70]
              name: (identifier [32, 61] - [32, 70])))
          (keyword_references [32, 72] - [32, 82])
          (table_reference [32, 83] - [32, 92]
            name: (identifier [32, 83] - [32, 92]))
          (ordered_columns [32, 93] - [32, 106]
            (column [32, 94] - [32, 105]
              name: (identifier [32, 94] - [32, 105])))))))
  (statement [34, 0] - [37, 2]
    (create_table [34, 0] - [37, 1]
      (keyword_create [34, 0] - [34, 6])
      (keyword_table [34, 7] - [34, 12])
      (table_reference [34, 13] - [34, 26]
        name: (identifier [34, 13] - [34, 26]))
      (column_definitions [34, 27] - [37, 1]
        (column_definition [35, 2] - [35, 26]
          name: (identifier [35, 2] - [35, 10])
          type: (bigint [35, 11] - [35, 17]
            (keyword_bigint [35, 11] - [35, 17]))
          (keyword_not [35, 18] - [35, 21])
          (keyword_null [35, 22] - [35, 26]))
        (column_definition [36, 2] - [36, 29]
          name: (identifier [36, 2] - [36, 13])
          type: (bigint [36, 14] - [36, 20]
            (keyword_bigint [36, 14] - [36, 20]))
          (keyword_not [36, 21] - [36, 24])
          (keyword_null [36, 25] - [36, 29])))))
  (statement [39, 0] - [39, 93]
    (alter_table [39, 0] - [39, 92]
      (keyword_alter [39, 0] - [39, 5])
      (keyword_table [39, 6] - [39, 11])
      (table_reference [39, 12] - [39, 25]
        name: (identifier [39, 12] - [39, 25]))
      (add_constraint [39, 26] - [39, 92]
        (keyword_add [39, 26] - [39, 29])
        (keyword_constraint [39, 30] - [39, 40])
        (field [39, 41] - [39, 56]
          name: (identifier [39, 41] - [39, 56]))
        (constraint [39, 57] - [39, 92]
          (keyword_primary [39, 57] - [39, 64])
          (keyword_key [39, 65] - [39, 68])
          (ordered_columns [39, 69] - [39, 92]
            (column [39, 70] - [39, 78]
              name: (identifier [39, 70] - [39, 78]))
            (column [39, 80] - [39, 91]
              name: (identifier [39, 80] - [39, 91])))))))
  (statement [40, 0] - [40, 131]
    (alter_table [40, 0] - [40, 130]
      (keyword_alter [40, 0] - [40, 5])
      (keyword_table [40, 6] - [40, 11])
      (table_reference [40, 12] - [40, 25]
        name: (identifier [40, 12] - [40, 25]))
      (add_constraint [40, 26] - [40, 130]
        (keyword_add [40, 26] - [40, 29])
        (keyword_constraint [40, 30] - [40, 40])
        (field [40, 41] - [40, 60]
          name: (identifier [40, 41] - [40, 60]))
        (constraint [40, 61] - [40, 130]
          (keyword_foreign [40, 61] - [40, 68])
          (keyword_key [40, 69] - [40, 72])
          (ordered_columns [40, 73] - [40, 83]
            (column [40, 74] - [40, 82]
              name: (identifier [40, 74] - [40, 82])))
          (keyword_references [40, 84] - [40, 94])
          (table_reference [40, 95] - [40, 101]
            name: (identifier [40, 95] - [40, 101]))
          (ordered_columns [40, 102] - [40, 112]
            (column [40, 103] - [40, 111]
              name: (identifier [40, 103] - [40, 111])))
          (keyword_on [40, 113] - [40, 115])
          (keyword_delete [40, 116] - [40, 122])
          (keyword_cascade [40, 123] - [40, 130])))))
  (statement [41, 0] - [41, 143]
    (alter_table [41, 0] - [41, 142]
      (keyword_alter [41, 0] - [41, 5])
      (keyword_table [41, 6] - [41, 11])
      (table_reference [41, 12] - [41, 25]
        name: (identifier [41, 12] - [41, 25]))
      (add_constraint [41, 26] - [41, 142]
        (keyword_add [41, 26] - [41, 29])
        (keyword_constraint [41, 30] - [41, 40])
        (field [41, 41] - [41, 63]
          name: (identifier [41, 41] - [41, 63]))
        (constraint [41, 64] - [41, 142]
          (keyword_foreign [41, 64] - [41, 71])
          (keyword_key [41, 72] - [41, 75])
          (ordered_columns [41, 76] - [41, 89]
            (column [41, 77] - [41, 88]
              name: (identifier [41, 77] - [41, 88])))
          (keyword_references [41, 90] - [41, 100])
          (table_reference [41, 101] - [41, 110]
            name: (identifier [41, 101] - [41, 110]))
          (ordered_columns [41, 111] - [41, 124]
            (column [41, 112] - [41, 123]
              name: (identifier [41, 112] - [41, 123])))
          (keyword_on [41, 125] - [41, 127])
          (keyword_delete [41, 128] - [41, 134])
          (keyword_cascade [41, 135] - [41, 142])))))
  (statement [42, 0] - [47, 2]
    (create_table [42, 0] - [47, 1]
      (keyword_create [42, 0] - [42, 6])
      (keyword_table [42, 7] - [42, 12])
      (table_reference [42, 13] - [42, 22]
        name: (identifier [42, 13] - [42, 22]))
      (column_definitions [42, 23] - [47, 1]
        (column_definition [43, 2] - [43, 49]
          name: (identifier [43, 2] - [43, 13])
          type: (bigint [43, 14] - [43, 20]
            (keyword_bigint [43, 14] - [43, 20]))
          (keyword_generated [43, 21] - [43, 30])
          (keyword_always [43, 31] - [43, 37])
          (keyword_as [43, 38] - [43, 40])
          (identifier [43, 41] - [43, 49]))
        (column_definition [44, 2] - [44, 26]
          name: (identifier [44, 2] - [44, 10])
          type: (bigint [44, 11] - [44, 17]
            (keyword_bigint [44, 11] - [44, 17]))
          (keyword_not [44, 18] - [44, 21])
          (keyword_null [44, 22] - [44, 26]))
        (column_definition [45, 2] - [45, 26]
          name: (identifier [45, 2] - [45, 10])
          type: (bigint [45, 11] - [45, 17]
            (keyword_bigint [45, 11] - [45, 17]))
          (keyword_not [45, 18] - [45, 21])
          (keyword_null [45, 22] - [45, 26]))
        (column_definition [46, 2] - [46, 25]
          name: (identifier [46, 2] - [46, 8])
          type: (varchar [46, 9] - [46, 16]
            (keyword_varchar [46, 9] - [46, 16]))
          (keyword_not [46, 17] - [46, 20])
          (keyword_null [46, 21] - [46, 25])))))
  (statement [49, 0] - [49, 75]
    (alter_table [49, 0] - [49, 74]
      (keyword_alter [49, 0] - [49, 5])
      (keyword_table [49, 6] - [49, 11])
      (table_reference [49, 12] - [49, 21]
        name: (identifier [49, 12] - [49, 21]))
      (add_constraint [49, 22] - [49, 74]
        (keyword_add [49, 22] - [49, 25])
        (keyword_constraint [49, 26] - [49, 36])
        (field [49, 37] - [49, 48]
          name: (identifier [49, 37] - [49, 48]))
        (constraint [49, 49] - [49, 74]
          (keyword_primary [49, 49] - [49, 56])
          (keyword_key [49, 57] - [49, 60])
          (ordered_columns [49, 61] - [49, 74]
            (column [49, 62] - [49, 73]
              name: (identifier [49, 62] - [49, 73])))))))
  (statement [50, 0] - [50, 105]
    (alter_table [50, 0] - [50, 104]
      (keyword_alter [50, 0] - [50, 5])
      (keyword_table [50, 6] - [50, 11])
      (table_reference [50, 12] - [50, 21]
        name: (identifier [50, 12] - [50, 21]))
      (add_constraint [50, 22] - [50, 104]
        (keyword_add [50, 22] - [50, 25])
        (keyword_constraint [50, 26] - [50, 36])
        (field [50, 37] - [50, 52]
          name: (identifier [50, 37] - [50, 52]))
        (constraint [50, 53] - [50, 104]
          (keyword_foreign [50, 53] - [50, 60])
          (keyword_key [50, 61] - [50, 64])
          (ordered_columns [50, 65] - [50, 75]
            (column [50, 66] - [50, 74]
              name: (identifier [50, 66] - [50, 74])))
          (keyword_references [50, 76] - [50, 86])
          (table_reference [50, 87] - [50, 93]
            name: (identifier [50, 87] - [50, 93]))
          (ordered_columns [50, 94] - [50, 104]
            (column [50, 95] - [50, 103]
              name: (identifier [50, 95] - [50, 103])))))))
  (statement [51, 0] - [51, 111]
    (alter_table [51, 0] - [51, 110]
      (keyword_alter [51, 0] - [51, 5])
      (keyword_table [51, 6] - [51, 11])
      (table_reference [51, 12] - [51, 21]
        name: (identifier [51, 12] - [51, 21]))
      (add_constraint [51, 22] - [51, 110]
        (keyword_add [51, 22] - [51, 25])
        (keyword_constraint [51, 26] - [51, 36])
        (field [51, 37] - [51, 52]
          name: (identifier [51, 37] - [51, 52]))
        (constraint [51, 53] - [51, 110]
          (keyword_foreign [51, 53] - [51, 60])
          (keyword_key [51, 61] - [51, 64])
          (ordered_columns [51, 65] - [51, 75]
            (column [51, 66] - [51, 74]
              name: (identifier [51, 66] - [51, 74])))
          (keyword_references [51, 76] - [51, 86])
          (table_reference [51, 87] - [51, 96]
            name: (identifier [51, 87] - [51, 96]))
          (ordered_columns [51, 97] - [51, 110]
            (column [51, 98] - [51, 109]
              name: (identifier [51, 98] - [51, 109])))))))
  (statement [52, 0] - [58, 2]
    (create_table [52, 0] - [58, 1]
      (keyword_create [52, 0] - [52, 6])
      (keyword_table [52, 7] - [52, 12])
      (table_reference [52, 13] - [52, 22]
        name: (identifier [52, 13] - [52, 22]))
      (column_definitions [52, 23] - [58, 1]
        (column_definition [53, 2] - [53, 49]
          name: (identifier [53, 2] - [53, 13])
          type: (bigint [53, 14] - [53, 20]
            (keyword_bigint [53, 14] - [53, 20]))
          (keyword_generated [53, 21] - [53, 30])
          (keyword_always [53, 31] - [53, 37])
          (keyword_as [53, 38] - [53, 40])
          (identifier [53, 41] - [53, 49]))
        (column_definition [54, 2] - [54, 29]
          name: (identifier [54, 2] - [54, 13])
          type: (bigint [54, 14] - [54, 20]
            (keyword_bigint [54, 14] - [54, 20]))
          (keyword_not [54, 21] - [54, 24])
          (keyword_null [54, 25] - [54, 29]))
        (column_definition [55, 2] - [55, 26]
          name: (identifier [55, 2] - [55, 9])
          type: (varchar [55, 10] - [55, 17]
            (keyword_varchar [55, 10] - [55, 17]))
          (keyword_not [55, 18] - [55, 21])
          (keyword_null [55, 22] - [55, 26]))
        (column_definition [56, 2] - [56, 20]
          name: (identifier [56, 2] - [56, 6])
          type: (keyword_inet [56, 7] - [56, 11])
          (keyword_not [56, 12] - [56, 15])
          (keyword_null [56, 16] - [56, 20]))
        (column_definition [57, 2] - [57, 23]
          name: (identifier [57, 2] - [57, 8])
          type: (keyword_jsonb [57, 9] - [57, 14])
          (keyword_not [57, 15] - [57, 18])
          (keyword_null [57, 19] - [57, 23])))))
  (statement [60, 0] - [60, 75]
    (alter_table [60, 0] - [60, 74]
      (keyword_alter [60, 0] - [60, 5])
      (keyword_table [60, 6] - [60, 11])
      (table_reference [60, 12] - [60, 21]
        name: (identifier [60, 12] - [60, 21]))
      (add_constraint [60, 22] - [60, 74]
        (keyword_add [60, 22] - [60, 25])
        (keyword_constraint [60, 26] - [60, 36])
        (field [60, 37] - [60, 48]
          name: (identifier [60, 37] - [60, 48]))
        (constraint [60, 49] - [60, 74]
          (keyword_primary [60, 49] - [60, 56])
          (keyword_key [60, 57] - [60, 60])
          (ordered_columns [60, 61] - [60, 74]
            (column [60, 62] - [60, 73]
              name: (identifier [60, 62] - [60, 73])))))))
  (statement [61, 0] - [61, 117]
    (alter_table [61, 0] - [61, 116]
      (keyword_alter [61, 0] - [61, 5])
      (keyword_table [61, 6] - [61, 11])
      (table_reference [61, 12] - [61, 21]
        name: (identifier [61, 12] - [61, 21]))
      (add_constraint [61, 22] - [61, 116]
        (keyword_add [61, 22] - [61, 25])
        (keyword_constraint [61, 26] - [61, 36])
        (field [61, 37] - [61, 55]
          name: (identifier [61, 37] - [61, 55]))
        (constraint [61, 56] - [61, 116]
          (keyword_foreign [61, 56] - [61, 63])
          (keyword_key [61, 64] - [61, 67])
          (ordered_columns [61, 68] - [61, 81]
            (column [61, 69] - [61, 80]
              name: (identifier [61, 69] - [61, 80])))
          (keyword_references [61, 82] - [61, 92])
          (table_reference [61, 93] - [61, 102]
            name: (identifier [61, 93] - [61, 102]))
          (ordered_columns [61, 103] - [61, 116]
            (column [61, 104] - [61, 115]
              name: (identifier [61, 104] - [61, 115])))))))
  (statement [62, 0] - [62, 60]
    (create_index [62, 0] - [62, 59]
      (keyword_create [62, 0] - [62, 6])
      (keyword_unique [62, 7] - [62, 13])
      (keyword_index [62, 14] - [62, 19])
      (literal [62, 20] - [62, 36])
      (keyword_on [62, 37] - [62, 39])
      (table_reference [62, 40] - [62, 49]
        name: (identifier [62, 40] - [62, 49]))
      (ordered_columns [62, 50] - [62, 59]
        (column [62, 51] - [62, 58]
          name: (identifier [62, 51] - [62, 58]))))))

@DerekStride DerekStride self-assigned this Apr 18, 2023
@DerekStride DerekStride mentioned this pull request Apr 19, 2023
@DerekStride DerekStride marked this pull request as ready for review April 20, 2023 13:20
@DerekStride DerekStride requested review from matthias-Q and dmfay April 20, 2023 13:21
@@ -1357,3 +1357,86 @@ CACHED IN 'pool1' WITH REPLICATION = 2
(keyword_with)
(keyword_replication)
value: (literal)))))

================================================================================
Create table with string name
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Test Name might be misleading. In postgres double quotes just mean that the Case is kept (e.g. "uPPeRCase") otherwise postgres will lowercase all characters by default.

@matthias-Q
Copy link
Collaborator

matthias-Q commented Apr 20, 2023

LGTM. @DerekStride I am short on time for the next three weeks. Should we also update the hightlights.scm downstream in nvim-treesitter?

@matthias-Q matthias-Q merged commit ecf2842 into main Apr 20, 2023
@DerekStride
Copy link
Owner Author

Yeah I can take care of updating it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SQL file lose syntax
2 participants