[
  {
    "namePrefix": "should suggest keywords",
    "beforeCursor": "",
    "afterCursor": "",
    "containsKeywords": [
      "UPDATE"
    ],
    "expectedResult": {
      "lowerCase": false
    }
  },
  {
    "namePrefix": "should suggest keywords",
    "beforeCursor": "UPDATE bar  ",
    "afterCursor": "",
    "expectedResult": {
      "lowerCase": false,
      "suggestKeywords": [
        "SET"
      ],
      "locations": [
        {
          "type": "statement",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 1,
            "last_column": 12
          }
        },
        {
          "type": "table",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 8,
            "last_column": 11
          },
          "identifierChain": [
            {
              "name": "bar"
            }
          ]
        }
      ]
    }
  },
  {
    "namePrefix": "should suggest keywords",
    "beforeCursor": "UPDATE bar SET id=1, foo=2 ",
    "afterCursor": "",
    "containsKeywords": [
      "WHERE"
    ],
    "expectedResult": {
      "lowerCase": false,
      "locations": [
        {
          "type": "statement",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 1,
            "last_column": 27
          }
        },
        {
          "type": "table",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 8,
            "last_column": 11
          },
          "identifierChain": [
            {
              "name": "bar"
            }
          ]
        },
        {
          "type": "column",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 16,
            "last_column": 18
          },
          "identifierChain": [
            {
              "name": "id"
            }
          ],
          "tables": [
            {
              "identifierChain": [
                {
                  "name": "bar"
                }
              ]
            }
          ],
          "qualified": false
        },
        {
          "type": "column",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 22,
            "last_column": 25
          },
          "identifierChain": [
            {
              "name": "foo"
            }
          ],
          "tables": [
            {
              "identifierChain": [
                {
                  "name": "bar"
                }
              ]
            }
          ],
          "qualified": false
        }
      ]
    }
  },
  {
    "namePrefix": "should suggest keywords",
    "beforeCursor": "UPDATE bar SET id ",
    "afterCursor": "",
    "expectedResult": {
      "lowerCase": false,
      "suggestKeywords": [
        "="
      ],
      "locations": [
        {
          "type": "statement",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 1,
            "last_column": 18
          }
        },
        {
          "type": "table",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 8,
            "last_column": 11
          },
          "identifierChain": [
            {
              "name": "bar"
            }
          ]
        },
        {
          "type": "column",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 16,
            "last_column": 18
          },
          "identifierChain": [
            {
              "name": "id"
            }
          ],
          "tables": [
            {
              "identifierChain": [
                {
                  "name": "bar"
                }
              ]
            }
          ],
          "qualified": false
        }
      ]
    }
  },
  {
    "namePrefix": "should suggest tables",
    "beforeCursor": "UPDATE ",
    "afterCursor": "",
    "expectedResult": {
      "lowerCase": false,
      "suggestTables": {},
      "suggestDatabases": {
        "appendDot": true
      }
    }
  },
  {
    "namePrefix": "should suggest tables",
    "beforeCursor": "UPDATE bla",
    "afterCursor": "",
    "expectedResult": {
      "lowerCase": false,
      "suggestTables": {},
      "suggestDatabases": {
        "appendDot": true
      }
    }
  },
  {
    "namePrefix": "should suggest tables",
    "beforeCursor": "UPDATE bar.",
    "afterCursor": "",
    "expectedResult": {
      "lowerCase": false,
      "suggestTables": {
        "identifierChain": [
          {
            "name": "bar"
          }
        ]
      }
    }
  },
  {
    "namePrefix": "should suggest tables",
    "beforeCursor": "UPDATE bar.foo",
    "afterCursor": "",
    "expectedResult": {
      "lowerCase": false,
      "suggestTables": {
        "identifierChain": [
          {
            "name": "bar"
          }
        ]
      }
    }
  },
  {
    "namePrefix": "should suggest columns",
    "beforeCursor": "UPDATE bar.foo SET ",
    "afterCursor": "",
    "expectedResult": {
      "lowerCase": false,
      "suggestColumns": {
        "tables": [
          {
            "identifierChain": [
              {
                "name": "bar"
              },
              {
                "name": "foo"
              }
            ]
          }
        ]
      },
      "locations": [
        {
          "type": "statement",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 1,
            "last_column": 19
          }
        },
        {
          "type": "database",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 8,
            "last_column": 11
          },
          "identifierChain": [
            {
              "name": "bar"
            }
          ]
        },
        {
          "type": "table",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 12,
            "last_column": 15
          },
          "identifierChain": [
            {
              "name": "bar"
            },
            {
              "name": "foo"
            }
          ]
        }
      ]
    }
  },
  {
    "namePrefix": "should suggest columns",
    "beforeCursor": "UPDATE bar.foo SET id = 1, bla = 'foo', ",
    "afterCursor": "",
    "expectedResult": {
      "lowerCase": false,
      "suggestColumns": {
        "tables": [
          {
            "identifierChain": [
              {
                "name": "bar"
              },
              {
                "name": "foo"
              }
            ]
          }
        ]
      },
      "locations": [
        {
          "type": "statement",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 1,
            "last_column": 40
          }
        },
        {
          "type": "database",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 8,
            "last_column": 11
          },
          "identifierChain": [
            {
              "name": "bar"
            }
          ]
        },
        {
          "type": "table",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 12,
            "last_column": 15
          },
          "identifierChain": [
            {
              "name": "bar"
            },
            {
              "name": "foo"
            }
          ]
        },
        {
          "type": "column",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 20,
            "last_column": 22
          },
          "identifierChain": [
            {
              "name": "id"
            }
          ],
          "tables": [
            {
              "identifierChain": [
                {
                  "name": "bar"
                },
                {
                  "name": "foo"
                }
              ]
            }
          ],
          "qualified": false
        },
        {
          "type": "column",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 28,
            "last_column": 31
          },
          "identifierChain": [
            {
              "name": "bla"
            }
          ],
          "tables": [
            {
              "identifierChain": [
                {
                  "name": "bar"
                },
                {
                  "name": "foo"
                }
              ]
            }
          ],
          "qualified": false
        }
      ]
    }
  },
  {
    "namePrefix": "should suggest columns",
    "beforeCursor": "UPDATE bar.foo SET bla = 'foo' WHERE ",
    "afterCursor": "",
    "expectedResult": {
      "lowerCase": false,
      "suggestFunctions": {},
      "suggestColumns": {
        "tables": [
          {
            "identifierChain": [
              {
                "name": "bar"
              },
              {
                "name": "foo"
              }
            ]
          }
        ]
      },
      "suggestFilters": {
        "tables": [
          {
            "identifierChain": [
              {
                "name": "bar"
              },
              {
                "name": "foo"
              }
            ]
          }
        ]
      },
      "suggestKeywords": [
        "EXISTS",
        "NOT EXISTS"
      ],
      "locations": [
        {
          "type": "statement",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 1,
            "last_column": 37
          }
        },
        {
          "type": "database",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 8,
            "last_column": 11
          },
          "identifierChain": [
            {
              "name": "bar"
            }
          ]
        },
        {
          "type": "table",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 12,
            "last_column": 15
          },
          "identifierChain": [
            {
              "name": "bar"
            },
            {
              "name": "foo"
            }
          ]
        },
        {
          "type": "column",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 20,
            "last_column": 23
          },
          "identifierChain": [
            {
              "name": "bla"
            }
          ],
          "tables": [
            {
              "identifierChain": [
                {
                  "name": "bar"
                },
                {
                  "name": "foo"
                }
              ]
            }
          ],
          "qualified": false
        }
      ]
    }
  },
  {
    "namePrefix": "should suggest values",
    "beforeCursor": "UPDATE bar.foo SET bla = 'foo' WHERE id = ",
    "afterCursor": "",
    "containsKeywords": [
      "CASE"
    ],
    "expectedResult": {
      "locations": [
        {
          "type": "statement",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 1,
            "last_column": 42
          }
        },
        {
          "type": "database",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 8,
            "last_column": 11
          },
          "identifierChain": [
            {
              "name": "bar"
            }
          ]
        },
        {
          "type": "table",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 12,
            "last_column": 15
          },
          "identifierChain": [
            {
              "name": "bar"
            },
            {
              "name": "foo"
            }
          ]
        },
        {
          "type": "column",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 20,
            "last_column": 23
          },
          "identifierChain": [
            {
              "name": "bla"
            }
          ],
          "tables": [
            {
              "identifierChain": [
                {
                  "name": "bar"
                },
                {
                  "name": "foo"
                }
              ]
            }
          ],
          "qualified": false
        },
        {
          "type": "column",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 38,
            "last_column": 40
          },
          "identifierChain": [
            {
              "name": "id"
            }
          ],
          "tables": [
            {
              "identifierChain": [
                {
                  "name": "bar"
                },
                {
                  "name": "foo"
                }
              ]
            }
          ],
          "qualified": false
        }
      ],
      "suggestFunctions": {
        "types": [
          "COLREF"
        ]
      },
      "suggestValues": {},
      "colRef": {
        "identifierChain": [
          {
            "name": "bar"
          },
          {
            "name": "foo"
          },
          {
            "name": "id"
          }
        ]
      },
      "suggestColumns": {
        "types": [
          "COLREF"
        ],
        "tables": [
          {
            "identifierChain": [
              {
                "name": "bar"
              },
              {
                "name": "foo"
              }
            ]
          }
        ]
      },
      "lowerCase": false
    }
  },
  {
    "namePrefix": "should suggest columns",
    "beforeCursor": "UPDATE bar.foo SET bla = 'foo' WHERE id = 1 AND ",
    "afterCursor": "",
    "containsKeywords": [
      "CASE"
    ],
    "expectedResult": {
      "lowerCase": false,
      "suggestFunctions": {},
      "suggestColumns": {
        "tables": [
          {
            "identifierChain": [
              {
                "name": "bar"
              },
              {
                "name": "foo"
              }
            ]
          }
        ]
      },
      "suggestFilters": {
        "tables": [
          {
            "identifierChain": [
              {
                "name": "bar"
              },
              {
                "name": "foo"
              }
            ]
          }
        ]
      },
      "locations": [
        {
          "type": "statement",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 1,
            "last_column": 48
          }
        },
        {
          "type": "database",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 8,
            "last_column": 11
          },
          "identifierChain": [
            {
              "name": "bar"
            }
          ]
        },
        {
          "type": "table",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 12,
            "last_column": 15
          },
          "identifierChain": [
            {
              "name": "bar"
            },
            {
              "name": "foo"
            }
          ]
        },
        {
          "type": "column",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 20,
            "last_column": 23
          },
          "identifierChain": [
            {
              "name": "bla"
            }
          ],
          "tables": [
            {
              "identifierChain": [
                {
                  "name": "bar"
                },
                {
                  "name": "foo"
                }
              ]
            }
          ],
          "qualified": false
        },
        {
          "type": "column",
          "location": {
            "first_line": 1,
            "last_line": 1,
            "first_column": 38,
            "last_column": 40
          },
          "identifierChain": [
            {
              "name": "id"
            }
          ],
          "tables": [
            {
              "identifierChain": [
                {
                  "name": "bar"
                },
                {
                  "name": "foo"
                }
              ]
            }
          ],
          "qualified": false
        }
      ]
    }
  }
]
