---
source: crates/squawk_parser/tests/tests.rs
input_file: crates/squawk_parser/tests/data/ok/update.sql
---
SOURCE_FILE
  COMMENT "-- update"
  WHITESPACE "\n"
  COMMENT "-- update where"
  WHITESPACE "\n"
  UPDATE
    UPDATE_KW "update"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "products"
    WHITESPACE " "
    SET_CLAUSE
      SET_KW "set"
      WHITESPACE " "
      SET_COLUMN_LIST
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "price"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            LITERAL
              INT_NUMBER "10"
    WHITESPACE " "
    WHERE_CLAUSE
      WHERE_KW "where"
      WHITESPACE " "
      BIN_EXPR
        NAME_REF
          IDENT "price"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        LITERAL
          INT_NUMBER "5"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- no where"
  WHITESPACE "\n"
  UPDATE
    UPDATE_KW "UPDATE"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "products"
    WHITESPACE " "
    SET_CLAUSE
      SET_KW "SET"
      WHITESPACE " "
      SET_COLUMN_LIST
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "price"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            BIN_EXPR
              NAME_REF
                IDENT "price"
              WHITESPACE " "
              STAR "*"
              WHITESPACE " "
              LITERAL
                FLOAT_NUMBER "1.10"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- set muliple"
  WHITESPACE "\n"
  UPDATE
    UPDATE_KW "update"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "mytable"
    WHITESPACE " "
    SET_CLAUSE
      SET_KW "set"
      WHITESPACE " "
      SET_COLUMN_LIST
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "a"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            LITERAL
              INT_NUMBER "5"
        COMMA ","
        WHITESPACE " "
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "b"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            LITERAL
              INT_NUMBER "3"
        COMMA ","
        WHITESPACE " "
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "c"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            LITERAL
              INT_NUMBER "1"
    WHITESPACE " "
    WHERE_CLAUSE
      WHERE_KW "where"
      WHITESPACE " "
      BIN_EXPR
        NAME_REF
          IDENT "a"
        WHITESPACE " "
        R_ANGLE ">"
        WHITESPACE " "
        LITERAL
          INT_NUMBER "0"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- sub_select"
  WHITESPACE "\n"
  UPDATE
    UPDATE_KW "update"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "t"
    WHITESPACE " "
    SET_CLAUSE
      SET_KW "set"
      WHITESPACE " "
      SET_COLUMN_LIST
        SET_MULTIPLE_COLUMNS
          COLUMN_LIST
            L_PAREN "("
            COLUMN
              NAME_REF
                IDENT "z"
            R_PAREN ")"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          PAREN_SELECT
            L_PAREN "("
            SELECT
              SELECT_CLAUSE
                SELECT_KW "select"
                WHITESPACE " "
                TARGET_LIST
                  TARGET
                    LITERAL
                      INT_NUMBER "1"
            R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n\n"
  COMMENT "-- with_stmt"
  WHITESPACE "\n"
  UPDATE
    WITH_CLAUSE
      WITH_KW "with"
      WHITESPACE " "
      WITH_TABLE
        NAME
          IDENT "t1"
        WHITESPACE " "
        AS_KW "as"
        WHITESPACE " "
        L_PAREN "("
        WHITESPACE "\n  "
        SELECT
          SELECT_CLAUSE
            SELECT_KW "select"
            WHITESPACE " "
            TARGET_LIST
              TARGET
                LITERAL
                  INT_NUMBER "1"
        WHITESPACE "\n"
        R_PAREN ")"
    WHITESPACE "\n"
    UPDATE_KW "update"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "t2"
    WHITESPACE " "
    SET_CLAUSE
      SET_KW "set"
      WHITESPACE " \n  "
      SET_COLUMN_LIST
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "foo"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            DEFAULT_KW "default"
    WHITESPACE "\n"
    FROM_CLAUSE
      FROM_KW "from"
      WHITESPACE " "
      FROM_ITEM
        NAME_REF
          IDENT "t1"
    WHITESPACE " "
    WHERE_CLAUSE
      WHERE_KW "where"
      WHITESPACE " "
      BIN_EXPR
        FIELD_EXPR
          NAME_REF
            IDENT "t2"
          DOT "."
          NAME_REF
            IDENT "foo_id"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        FIELD_EXPR
          NAME_REF
            IDENT "t1"
          DOT "."
          NAME_REF
            IDENT "foo_id"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- based_on_schema"
  WHITESPACE "\n"
  COMMENT "-- all options"
  WHITESPACE "\n"
  UPDATE
    UPDATE_KW "update"
    WHITESPACE " "
    RELATION_NAME
      ONLY_KW "only"
      WHITESPACE " "
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "t"
    WHITESPACE " "
    ALIAS
      AS_KW "as"
      WHITESPACE " "
      NAME
        IDENT "t2"
    WHITESPACE " \n"
    SET_CLAUSE
      SET_KW "set"
      WHITESPACE " \n  "
      SET_COLUMN_LIST
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "bar"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            BIN_EXPR
              NAME_REF
                IDENT "a"
              WHITESPACE " "
              STAR "*"
              WHITESPACE " "
              LITERAL
                INT_NUMBER "2"
        COMMA ","
        WHITESPACE "\n  "
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "foo"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            DEFAULT_KW "default"
        COMMA ","
        WHITESPACE "\n  "
        SET_MULTIPLE_COLUMNS
          COLUMN_LIST
            L_PAREN "("
            COLUMN
              NAME_REF
                IDENT "a"
            R_PAREN ")"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR_LIST
            ROW_KW "row"
            L_PAREN "("
            SET_EXPR
              DEFAULT_KW "default"
            R_PAREN ")"
        COMMA ","
        WHITESPACE "\n  "
        SET_MULTIPLE_COLUMNS
          COLUMN_LIST
            L_PAREN "("
            COLUMN
              NAME_REF
                IDENT "b"
            COMMA ","
            WHITESPACE " "
            COLUMN
              NAME_REF
                IDENT "c"
            R_PAREN ")"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR_LIST
            L_PAREN "("
            SET_EXPR
              LITERAL
                INT_NUMBER "2"
            COMMA ","
            WHITESPACE " "
            SET_EXPR
              LITERAL
                INT_NUMBER "3"
            R_PAREN ")"
        COMMA ","
        WHITESPACE "\n  "
        SET_MULTIPLE_COLUMNS
          COLUMN_LIST
            L_PAREN "("
            COLUMN
              NAME_REF
                IDENT "z"
            R_PAREN ")"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          PAREN_SELECT
            L_PAREN "("
            SELECT
              SELECT_CLAUSE
                SELECT_KW "select"
                WHITESPACE " "
                TARGET_LIST
                  TARGET
                    LITERAL
                      INT_NUMBER "1"
            R_PAREN ")"
    WHITESPACE "\n"
    FROM_CLAUSE
      FROM_KW "from"
      WHITESPACE " "
      FROM_ITEM
        NAME_REF
          IDENT "a"
      COMMA ","
      WHITESPACE " "
      FROM_ITEM
        NAME_REF
          IDENT "b"
    WHITESPACE "\n"
    WHERE_CLAUSE
      WHERE_KW "where"
      WHITESPACE " "
      BIN_EXPR
        NAME_REF
          IDENT "t2"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        NAME_REF
          IDENT "t"
    WHITESPACE "\n"
    RETURNING_CLAUSE
      RETURNING_KW "returning"
      WHITESPACE " "
      TARGET_LIST
        TARGET
          STAR "*"
        COMMA ","
        WHITESPACE " "
        TARGET
          BIN_EXPR
            NAME_REF
              IDENT "foo"
            WHITESPACE " "
            STAR "*"
            WHITESPACE " "
            LITERAL
              INT_NUMBER "2"
          WHITESPACE " "
          AS_NAME
            AS_KW "as"
            WHITESPACE " "
            NAME
              IDENT "bar"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- pg_docs"
  WHITESPACE "\n"
  UPDATE
    UPDATE_KW "UPDATE"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "films"
    WHITESPACE " "
    SET_CLAUSE
      SET_KW "SET"
      WHITESPACE " "
      SET_COLUMN_LIST
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "kind"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            LITERAL
              STRING "'Dramatic'"
    WHITESPACE " "
    WHERE_CLAUSE
      WHERE_KW "WHERE"
      WHITESPACE " "
      BIN_EXPR
        NAME_REF
          IDENT "kind"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        LITERAL
          STRING "'Drama'"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  UPDATE
    UPDATE_KW "UPDATE"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "weather"
    WHITESPACE " "
    SET_CLAUSE
      SET_KW "SET"
      WHITESPACE " "
      SET_COLUMN_LIST
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "temp_lo"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            BIN_EXPR
              NAME_REF
                IDENT "temp_lo"
              PLUS "+"
              LITERAL
                INT_NUMBER "1"
        COMMA ","
        WHITESPACE " "
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "temp_hi"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            BIN_EXPR
              NAME_REF
                IDENT "temp_lo"
              PLUS "+"
              LITERAL
                INT_NUMBER "15"
        COMMA ","
        WHITESPACE " "
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "prcp"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            DEFAULT_KW "DEFAULT"
    WHITESPACE "\n  "
    WHERE_CLAUSE
      WHERE_KW "WHERE"
      WHITESPACE " "
      BIN_EXPR
        BIN_EXPR
          NAME_REF
            IDENT "city"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          LITERAL
            STRING "'San Francisco'"
        WHITESPACE " "
        AND_KW "AND"
        WHITESPACE " "
        BIN_EXPR
          NAME_REF
            IDENT "date"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          LITERAL
            STRING "'2003-07-03'"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  UPDATE
    UPDATE_KW "UPDATE"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "weather"
    WHITESPACE " "
    SET_CLAUSE
      SET_KW "SET"
      WHITESPACE " "
      SET_COLUMN_LIST
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "temp_lo"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            BIN_EXPR
              NAME_REF
                IDENT "temp_lo"
              PLUS "+"
              LITERAL
                INT_NUMBER "1"
        COMMA ","
        WHITESPACE " "
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "temp_hi"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            BIN_EXPR
              NAME_REF
                IDENT "temp_lo"
              PLUS "+"
              LITERAL
                INT_NUMBER "15"
        COMMA ","
        WHITESPACE " "
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "prcp"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            DEFAULT_KW "DEFAULT"
    WHITESPACE "\n  "
    WHERE_CLAUSE
      WHERE_KW "WHERE"
      WHITESPACE " "
      BIN_EXPR
        BIN_EXPR
          NAME_REF
            IDENT "city"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          LITERAL
            STRING "'San Francisco'"
        WHITESPACE " "
        AND_KW "AND"
        WHITESPACE " "
        BIN_EXPR
          NAME_REF
            IDENT "date"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          LITERAL
            STRING "'2003-07-03'"
    WHITESPACE "\n  "
    RETURNING_CLAUSE
      RETURNING_KW "RETURNING"
      WHITESPACE " "
      TARGET_LIST
        TARGET
          NAME_REF
            IDENT "temp_lo"
        COMMA ","
        WHITESPACE " "
        TARGET
          NAME_REF
            IDENT "temp_hi"
        COMMA ","
        WHITESPACE " "
        TARGET
          NAME_REF
            IDENT "prcp"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  UPDATE
    UPDATE_KW "UPDATE"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "weather"
    WHITESPACE " "
    SET_CLAUSE
      SET_KW "SET"
      WHITESPACE " "
      SET_COLUMN_LIST
        SET_MULTIPLE_COLUMNS
          COLUMN_LIST
            L_PAREN "("
            COLUMN
              NAME_REF
                IDENT "temp_lo"
            COMMA ","
            WHITESPACE " "
            COLUMN
              NAME_REF
                IDENT "temp_hi"
            COMMA ","
            WHITESPACE " "
            COLUMN
              NAME_REF
                IDENT "prcp"
            R_PAREN ")"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR_LIST
            L_PAREN "("
            SET_EXPR
              BIN_EXPR
                NAME_REF
                  IDENT "temp_lo"
                PLUS "+"
                LITERAL
                  INT_NUMBER "1"
            COMMA ","
            WHITESPACE " "
            SET_EXPR
              BIN_EXPR
                NAME_REF
                  IDENT "temp_lo"
                PLUS "+"
                LITERAL
                  INT_NUMBER "15"
            COMMA ","
            WHITESPACE " "
            SET_EXPR
              DEFAULT_KW "DEFAULT"
            R_PAREN ")"
    WHITESPACE "\n  "
    WHERE_CLAUSE
      WHERE_KW "WHERE"
      WHITESPACE " "
      BIN_EXPR
        BIN_EXPR
          NAME_REF
            IDENT "city"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          LITERAL
            STRING "'San Francisco'"
        WHITESPACE " "
        AND_KW "AND"
        WHITESPACE " "
        BIN_EXPR
          NAME_REF
            IDENT "date"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          LITERAL
            STRING "'2003-07-03'"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  UPDATE
    UPDATE_KW "UPDATE"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "employees"
    WHITESPACE " "
    SET_CLAUSE
      SET_KW "SET"
      WHITESPACE " "
      SET_COLUMN_LIST
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "sales_count"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            BIN_EXPR
              NAME_REF
                IDENT "sales_count"
              WHITESPACE " "
              PLUS "+"
              WHITESPACE " "
              LITERAL
                INT_NUMBER "1"
    WHITESPACE " "
    FROM_CLAUSE
      FROM_KW "FROM"
      WHITESPACE " "
      FROM_ITEM
        NAME_REF
          IDENT "accounts"
    WHITESPACE "\n  "
    WHERE_CLAUSE
      WHERE_KW "WHERE"
      WHITESPACE " "
      BIN_EXPR
        BIN_EXPR
          FIELD_EXPR
            NAME_REF
              IDENT "accounts"
            DOT "."
            NAME_REF
              NAME_KW "name"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          LITERAL
            STRING "'Acme Corporation'"
        WHITESPACE "\n  "
        AND_KW "AND"
        WHITESPACE " "
        BIN_EXPR
          FIELD_EXPR
            NAME_REF
              IDENT "employees"
            DOT "."
            NAME_REF
              IDENT "id"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          FIELD_EXPR
            NAME_REF
              IDENT "accounts"
            DOT "."
            NAME_REF
              IDENT "sales_person"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  UPDATE
    UPDATE_KW "UPDATE"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "employees"
    WHITESPACE " "
    SET_CLAUSE
      SET_KW "SET"
      WHITESPACE " "
      SET_COLUMN_LIST
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "sales_count"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            BIN_EXPR
              NAME_REF
                IDENT "sales_count"
              WHITESPACE " "
              PLUS "+"
              WHITESPACE " "
              LITERAL
                INT_NUMBER "1"
    WHITESPACE " "
    WHERE_CLAUSE
      WHERE_KW "WHERE"
      WHITESPACE " "
      BIN_EXPR
        NAME_REF
          IDENT "id"
        WHITESPACE " "
        EQ "="
        WHITESPACE "\n  "
        PAREN_EXPR
          L_PAREN "("
          SELECT
            SELECT_CLAUSE
              SELECT_KW "SELECT"
              WHITESPACE " "
              TARGET_LIST
                TARGET
                  NAME_REF
                    IDENT "sales_person"
            WHITESPACE " "
            FROM_CLAUSE
              FROM_KW "FROM"
              WHITESPACE " "
              FROM_ITEM
                NAME_REF
                  IDENT "accounts"
            WHITESPACE " "
            WHERE_CLAUSE
              WHERE_KW "WHERE"
              WHITESPACE " "
              BIN_EXPR
                NAME_REF
                  NAME_KW "name"
                WHITESPACE " "
                EQ "="
                WHITESPACE " "
                LITERAL
                  STRING "'Acme Corporation'"
          R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  UPDATE
    UPDATE_KW "UPDATE"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "accounts"
    WHITESPACE " "
    SET_CLAUSE
      SET_KW "SET"
      WHITESPACE " "
      SET_COLUMN_LIST
        SET_MULTIPLE_COLUMNS
          COLUMN_LIST
            L_PAREN "("
            COLUMN
              NAME_REF
                IDENT "contact_first_name"
            COMMA ","
            WHITESPACE " "
            COLUMN
              NAME_REF
                IDENT "contact_last_name"
            R_PAREN ")"
          WHITESPACE " "
          EQ "="
          WHITESPACE "\n    "
          PAREN_SELECT
            L_PAREN "("
            SELECT
              SELECT_CLAUSE
                SELECT_KW "SELECT"
                WHITESPACE " "
                TARGET_LIST
                  TARGET
                    NAME_REF
                      IDENT "first_name"
                  COMMA ","
                  WHITESPACE " "
                  TARGET
                    NAME_REF
                      IDENT "last_name"
              WHITESPACE " "
              FROM_CLAUSE
                FROM_KW "FROM"
                WHITESPACE " "
                FROM_ITEM
                  NAME_REF
                    IDENT "employees"
              WHITESPACE "\n     "
              WHERE_CLAUSE
                WHERE_KW "WHERE"
                WHITESPACE " "
                BIN_EXPR
                  FIELD_EXPR
                    NAME_REF
                      IDENT "employees"
                    DOT "."
                    NAME_REF
                      IDENT "id"
                  WHITESPACE " "
                  EQ "="
                  WHITESPACE " "
                  FIELD_EXPR
                    NAME_REF
                      IDENT "accounts"
                    DOT "."
                    NAME_REF
                      IDENT "sales_person"
            R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  UPDATE
    UPDATE_KW "UPDATE"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "accounts"
    WHITESPACE " "
    SET_CLAUSE
      SET_KW "SET"
      WHITESPACE " "
      SET_COLUMN_LIST
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "contact_first_name"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            NAME_REF
              IDENT "first_name"
        COMMA ","
        WHITESPACE "\n                    "
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "contact_last_name"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            NAME_REF
              IDENT "last_name"
    WHITESPACE "\n  "
    FROM_CLAUSE
      FROM_KW "FROM"
      WHITESPACE " "
      FROM_ITEM
        NAME_REF
          IDENT "employees"
    WHITESPACE " "
    WHERE_CLAUSE
      WHERE_KW "WHERE"
      WHITESPACE " "
      BIN_EXPR
        FIELD_EXPR
          NAME_REF
            IDENT "employees"
          DOT "."
          NAME_REF
            IDENT "id"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        FIELD_EXPR
          NAME_REF
            IDENT "accounts"
          DOT "."
          NAME_REF
            IDENT "sales_person"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  UPDATE
    UPDATE_KW "UPDATE"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "summary"
    WHITESPACE " "
    ALIAS
      NAME
        IDENT "s"
    WHITESPACE " "
    SET_CLAUSE
      SET_KW "SET"
      WHITESPACE " "
      SET_COLUMN_LIST
        SET_MULTIPLE_COLUMNS
          COLUMN_LIST
            L_PAREN "("
            COLUMN
              NAME_REF
                IDENT "sum_x"
            COMMA ","
            WHITESPACE " "
            COLUMN
              NAME_REF
                IDENT "sum_y"
            COMMA ","
            WHITESPACE " "
            COLUMN
              NAME_REF
                IDENT "avg_x"
            COMMA ","
            WHITESPACE " "
            COLUMN
              NAME_REF
                IDENT "avg_y"
            R_PAREN ")"
          WHITESPACE " "
          EQ "="
          WHITESPACE "\n    "
          PAREN_SELECT
            L_PAREN "("
            SELECT
              SELECT_CLAUSE
                SELECT_KW "SELECT"
                WHITESPACE " "
                TARGET_LIST
                  TARGET
                    CALL_EXPR
                      NAME_REF
                        IDENT "sum"
                      ARG_LIST
                        L_PAREN "("
                        NAME_REF
                          IDENT "x"
                        R_PAREN ")"
                  COMMA ","
                  WHITESPACE " "
                  TARGET
                    CALL_EXPR
                      NAME_REF
                        IDENT "sum"
                      ARG_LIST
                        L_PAREN "("
                        NAME_REF
                          IDENT "y"
                        R_PAREN ")"
                  COMMA ","
                  WHITESPACE " "
                  TARGET
                    CALL_EXPR
                      NAME_REF
                        IDENT "avg"
                      ARG_LIST
                        L_PAREN "("
                        NAME_REF
                          IDENT "x"
                        R_PAREN ")"
                  COMMA ","
                  WHITESPACE " "
                  TARGET
                    CALL_EXPR
                      NAME_REF
                        IDENT "avg"
                      ARG_LIST
                        L_PAREN "("
                        NAME_REF
                          IDENT "y"
                        R_PAREN ")"
              WHITESPACE " "
              FROM_CLAUSE
                FROM_KW "FROM"
                WHITESPACE " "
                FROM_ITEM
                  NAME_REF
                    DATA_KW "data"
                  WHITESPACE " "
                  ALIAS
                    NAME
                      IDENT "d"
              WHITESPACE "\n     "
              WHERE_CLAUSE
                WHERE_KW "WHERE"
                WHITESPACE " "
                BIN_EXPR
                  FIELD_EXPR
                    NAME_REF
                      IDENT "d"
                    DOT "."
                    NAME_REF
                      IDENT "group_id"
                  WHITESPACE " "
                  EQ "="
                  WHITESPACE " "
                  FIELD_EXPR
                    NAME_REF
                      IDENT "s"
                    DOT "."
                    NAME_REF
                      IDENT "group_id"
            R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  BEGIN
    BEGIN_KW "BEGIN"
  SEMICOLON ";"
  WHITESPACE "\n"
  COMMENT "-- other operations"
  WHITESPACE "\n"
  SAVEPOINT
    SAVEPOINT_KW "SAVEPOINT"
    WHITESPACE " "
    NAME
      IDENT "sp1"
  SEMICOLON ";"
  WHITESPACE "\n"
  INSERT
    INSERT_KW "INSERT"
    WHITESPACE " "
    INTO_KW "INTO"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME_REF
          IDENT "wines"
    WHITESPACE " "
    VALUES
      VALUES_KW "VALUES"
      ROW_LIST
        ROW
          L_PAREN "("
          LITERAL
            STRING "'Chateau Lafite 2003'"
          COMMA ","
          WHITESPACE " "
          LITERAL
            STRING "'24'"
          R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n"
  COMMENT "-- Assume the above fails because of a unique key violation,"
  WHITESPACE "\n"
  COMMENT "-- so now we issue these commands:"
  WHITESPACE "\n"
  ROLLBACK
    ROLLBACK_KW "ROLLBACK"
    WHITESPACE " "
    TO_KW "TO"
    WHITESPACE " "
    NAME_REF
      IDENT "sp1"
  SEMICOLON ";"
  WHITESPACE "\n"
  UPDATE
    UPDATE_KW "UPDATE"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "wines"
    WHITESPACE " "
    SET_CLAUSE
      SET_KW "SET"
      WHITESPACE " "
      SET_COLUMN_LIST
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "stock"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            BIN_EXPR
              NAME_REF
                IDENT "stock"
              WHITESPACE " "
              PLUS "+"
              WHITESPACE " "
              LITERAL
                INT_NUMBER "24"
    WHITESPACE " "
    WHERE_CLAUSE
      WHERE_KW "WHERE"
      WHITESPACE " "
      BIN_EXPR
        NAME_REF
          IDENT "winename"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        LITERAL
          STRING "'Chateau Lafite 2003'"
  SEMICOLON ";"
  WHITESPACE "\n"
  COMMENT "-- continue with other operations, and eventually"
  WHITESPACE "\n"
  COMMIT
    COMMIT_KW "COMMIT"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  UPDATE
    UPDATE_KW "UPDATE"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "films"
    WHITESPACE " "
    SET_CLAUSE
      SET_KW "SET"
      WHITESPACE " "
      SET_COLUMN_LIST
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "kind"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            LITERAL
              STRING "'Dramatic'"
    WHITESPACE " "
    WHERE_CURRENT_OF
      WHERE_KW "WHERE"
      WHITESPACE " "
      CURRENT_KW "CURRENT"
      WHITESPACE " "
      OF_KW "OF"
      WHITESPACE " "
      NAME_REF
        IDENT "c_films"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  UPDATE
    WITH_CLAUSE
      WITH_KW "WITH"
      WHITESPACE " "
      WITH_TABLE
        NAME
          IDENT "exceeded_max_retries"
        WHITESPACE " "
        AS_KW "AS"
        WHITESPACE " "
        L_PAREN "("
        WHITESPACE "\n  "
        SELECT
          SELECT_CLAUSE
            SELECT_KW "SELECT"
            WHITESPACE " "
            TARGET_LIST
              TARGET
                FIELD_EXPR
                  NAME_REF
                    IDENT "w"
                  DOT "."
                  NAME_REF
                    IDENT "ctid"
          WHITESPACE " "
          FROM_CLAUSE
            FROM_KW "FROM"
            WHITESPACE " "
            FROM_ITEM
              NAME_REF
                IDENT "work_item"
              WHITESPACE " "
              ALIAS
                AS_KW "AS"
                WHITESPACE " "
                NAME
                  IDENT "w"
          WHITESPACE "\n    "
          WHERE_CLAUSE
            WHERE_KW "WHERE"
            WHITESPACE " "
            BIN_EXPR
              BIN_EXPR
                FIELD_EXPR
                  NAME_REF
                    IDENT "w"
                  DOT "."
                  NAME_REF
                    IDENT "status"
                WHITESPACE " "
                EQ "="
                WHITESPACE " "
                LITERAL
                  STRING "'active'"
              WHITESPACE " "
              AND_KW "AND"
              WHITESPACE " "
              BIN_EXPR
                FIELD_EXPR
                  NAME_REF
                    IDENT "w"
                  DOT "."
                  NAME_REF
                    IDENT "num_retries"
                WHITESPACE " "
                R_ANGLE ">"
                WHITESPACE " "
                LITERAL
                  INT_NUMBER "10"
          WHITESPACE "\n    "
          ORDER_BY_CLAUSE
            ORDER_KW "ORDER"
            WHITESPACE " "
            BY_KW "BY"
            WHITESPACE " "
            SORT_BY_LIST
              SORT_BY
                FIELD_EXPR
                  NAME_REF
                    IDENT "w"
                  DOT "."
                  NAME_REF
                    IDENT "retry_timestamp"
          WHITESPACE "\n    "
          LOCKING_CLAUSE
            FOR_KW "FOR"
            WHITESPACE " "
            UPDATE_KW "UPDATE"
          WHITESPACE "\n    "
          LIMIT_CLAUSE
            LIMIT_KW "LIMIT"
            WHITESPACE " "
            LITERAL
              INT_NUMBER "5000"
        WHITESPACE "\n"
        R_PAREN ")"
    WHITESPACE "\n"
    UPDATE_KW "UPDATE"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "work_item"
    WHITESPACE " "
    SET_CLAUSE
      SET_KW "SET"
      WHITESPACE " "
      SET_COLUMN_LIST
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "status"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            LITERAL
              STRING "'failed'"
    WHITESPACE "\n  "
    FROM_CLAUSE
      FROM_KW "FROM"
      WHITESPACE " "
      FROM_ITEM
        NAME_REF
          IDENT "exceeded_max_retries"
        WHITESPACE " "
        ALIAS
          AS_KW "AS"
          WHITESPACE " "
          NAME
            IDENT "emr"
    WHITESPACE "\n  "
    WHERE_CLAUSE
      WHERE_KW "WHERE"
      WHITESPACE " "
      BIN_EXPR
        FIELD_EXPR
          NAME_REF
            IDENT "work_item"
          DOT "."
          NAME_REF
            IDENT "ctid"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        FIELD_EXPR
          NAME_REF
            IDENT "emr"
          DOT "."
          NAME_REF
            IDENT "ctid"
  SEMICOLON ";"
  WHITESPACE "\n\n\n"
  COMMENT "-- returning_with_old_new"
  WHITESPACE "\n"
  UPDATE
    UPDATE_KW "UPDATE"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "inventory"
    WHITESPACE "\n"
    SET_CLAUSE
      SET_KW "SET"
      WHITESPACE " "
      SET_COLUMN_LIST
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "quantity"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            BIN_EXPR
              NAME_REF
                IDENT "quantity"
              WHITESPACE " "
              MINUS "-"
              WHITESPACE " "
              LITERAL
                INT_NUMBER "5"
    WHITESPACE "\n"
    WHERE_CLAUSE
      WHERE_KW "WHERE"
      WHITESPACE " "
      BIN_EXPR
        NAME_REF
          IDENT "product_id"
        WHITESPACE " "
        EQ "="
        WHITESPACE " "
        LITERAL
          INT_NUMBER "456"
    WHITESPACE "\n"
    RETURNING_CLAUSE
      RETURNING_KW "RETURNING"
      WHITESPACE " "
      RETURNING_OPTION_LIST
        WITH_KW "WITH"
        WHITESPACE " "
        L_PAREN "("
        RETURNING_OPTION
          OLD_KW "OLD"
          WHITESPACE " "
          AS_KW "AS"
          WHITESPACE " "
          NAME
            BEFORE_KW "before"
        COMMA ","
        WHITESPACE " "
        RETURNING_OPTION
          NEW_KW "NEW"
          WHITESPACE " "
          AS_KW "AS"
          WHITESPACE " "
          NAME
            AFTER_KW "after"
        R_PAREN ")"
      WHITESPACE "\n    "
      TARGET_LIST
        TARGET
          FIELD_EXPR
            NAME_REF
              BEFORE_KW "before"
            DOT "."
            NAME_REF
              IDENT "quantity"
          WHITESPACE " "
          AS_NAME
            AS_KW "AS"
            WHITESPACE " "
            NAME
              IDENT "previous_quantity"
        COMMA ","
        WHITESPACE "\n    "
        TARGET
          FIELD_EXPR
            NAME_REF
              AFTER_KW "after"
            DOT "."
            NAME_REF
              IDENT "quantity"
          WHITESPACE " "
          AS_NAME
            AS_KW "AS"
            WHITESPACE " "
            NAME
              IDENT "current_quantity"
        COMMA ","
        WHITESPACE "\n    "
        TARGET
          BIN_EXPR
            FIELD_EXPR
              NAME_REF
                AFTER_KW "after"
              DOT "."
              NAME_REF
                IDENT "quantity"
            WHITESPACE " "
            MINUS "-"
            WHITESPACE " "
            FIELD_EXPR
              NAME_REF
                BEFORE_KW "before"
              DOT "."
              NAME_REF
                IDENT "quantity"
          WHITESPACE " "
          AS_NAME
            AS_KW "AS"
            WHITESPACE " "
            NAME
              IDENT "change"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  UPDATE
    UPDATE_KW "update"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "t"
    WHITESPACE " "
    SET_CLAUSE
      SET_KW "set"
      WHITESPACE " "
      SET_COLUMN_LIST
        SET_SINGLE_COLUMN
          COLUMN
            NAME_REF
              IDENT "x"
          WHITESPACE " "
          EQ "="
          WHITESPACE " "
          SET_EXPR
            LITERAL
              INT_NUMBER "1"
    WHITESPACE " \n"
    RETURNING_CLAUSE
      RETURNING_KW "returning"
      WHITESPACE " "
      RETURNING_OPTION_LIST
        WITH_KW "with"
        WHITESPACE " "
        L_PAREN "("
        RETURNING_OPTION
          OLD_KW "old"
          WHITESPACE " "
          AS_KW "as"
          WHITESPACE " "
          NAME
            IDENT "o"
        COMMA ","
        WHITESPACE " "
        RETURNING_OPTION
          NEW_KW "new"
          WHITESPACE " "
          AS_KW "as"
          WHITESPACE " "
          NAME
            IDENT "n"
        R_PAREN ")"
      WHITESPACE " "
      TARGET_LIST
        TARGET
          FIELD_EXPR
            NAME_REF
              IDENT "o"
            DOT "."
            STAR "*"
        COMMA ","
        WHITESPACE " "
        TARGET
          FIELD_EXPR
            NAME_REF
              IDENT "n"
            DOT "."
            STAR "*"
  SEMICOLON ";"
  WHITESPACE "\n"
