---
source: crates/squawk_parser/tests/tests.rs
input_file: crates/squawk_parser/tests/data/err/alter_table.sql
---
SOURCE_FILE
  COMMENT "-- missing alter_table"
  WHITESPACE "\n"
  ERROR
    ADD_KW "add"
  WHITESPACE " "
  ERROR
    COLUMN_KW "column"
  WHITESPACE " "
  ERROR
    IDENT "foo"
  WHITESPACE " "
  ERROR
    BOOLEAN_KW "boolean"
  EMPTY_STMT
    SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- mismatch options"
  WHITESPACE "\n"
  ALTER_TABLE
    ALTER_KW "alter"
    WHITESPACE " "
    TABLE_KW "table"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "t"
    WHITESPACE " "
    ALTER_CONSTRAINT
      ALTER_KW "alter"
      WHITESPACE " "
      CONSTRAINT_KW "constraint"
      WHITESPACE " "
      NAME_REF
        IDENT "c"
      WHITESPACE " "
      NOT_DEFERRABLE_CONSTRAINT_OPTION
        NOT_KW "not"
        WHITESPACE " "
        DEFERRABLE_KW "deferrable"
      WHITESPACE " "
      INITIALLY_DEFERRED_CONSTRAINT_OPTION
        INITIALLY_KW "initially"
        WHITESPACE " "
        DEFERRED_KW "deferred"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  ALTER_TABLE
    ALTER_KW "alter"
    WHITESPACE " "
    TABLE_KW "table"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "t"
    WHITESPACE " \n"
    VALIDATE_CONSTRAINT
      VALIDATE_KW "validate"
      WHITESPACE " "
      CONSTRAINT_KW "constraint"
      WHITESPACE " "
      NAME_REF
        IDENT "foo"
    WHITESPACE " "
    VALIDATE_CONSTRAINT
      VALIDATE_KW "validate"
      WHITESPACE " "
      CONSTRAINT_KW "constraint"
      WHITESPACE " "
      NAME_REF
        IDENT "b"
  WHITESPACE " "
  SEMICOLON ";"
  WHITESPACE "\n"
  COMMENT "--                     ^ missing comma"
  WHITESPACE "\n\n"
  COMMENT "-- pg 18 only, via: https://www.depesz.com/2025/05/01/waiting-for-postgresql-18-allow-not-null-constraints-to-be-added-as-not-valid/"
  WHITESPACE "\n"
  ALTER_TABLE
    ALTER_KW "alter"
    WHITESPACE " "
    TABLE_KW "table"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH
          PATH_SEGMENT
            NAME_REF
              IDENT "public"
        DOT "."
        PATH_SEGMENT
          NAME_REF
            IDENT "copy_2"
    WHITESPACE " "
    ADD_CONSTRAINT
      ADD_KW "add"
      WHITESPACE " "
      NOT_NULL_CONSTRAINT
        CONSTRAINT_NAME
          CONSTRAINT_KW "constraint"
          WHITESPACE " "
          NAME
            IDENT "id_not_null"
        WHITESPACE " "
        NOT_KW "not"
        WHITESPACE " "
        NULL_KW "null"
        WHITESPACE " "
        NAME_REF
          IDENT "id"
      WHITESPACE " "
      NOT_VALID
        NOT_KW "not"
        WHITESPACE " "
        VALID_KW "valid"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- missing comma"
  WHITESPACE "\n"
  ALTER_FOREIGN_TABLE
    ALTER_KW "alter"
    WHITESPACE " "
    FOREIGN_KW "foreign"
    WHITESPACE " "
    TABLE_KW "table"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "t"
    WHITESPACE "\n  "
    ALTER_COLUMN
      ALTER_KW "alter"
      WHITESPACE " "
      NAME_REF
        IDENT "c"
      WHITESPACE " "
      SET_OPTIONS
        SET_KW "set"
        WHITESPACE " "
        ATTRIBUTE_LIST
          L_PAREN "("
          ATTRIBUTE_OPTION
            NAME
              IDENT "a"
          WHITESPACE " "
          ATTRIBUTE_OPTION
            NAME
              IDENT "b"
            WHITESPACE " "
            EQ "="
            WHITESPACE " "
            ATTRIBUTE_VALUE
              LITERAL
                INT_NUMBER "1"
          R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- extra comma"
  WHITESPACE "\n"
  ALTER_FOREIGN_TABLE
    ALTER_KW "alter"
    WHITESPACE " "
    FOREIGN_KW "foreign"
    WHITESPACE " "
    TABLE_KW "table"
    WHITESPACE " "
    RELATION_NAME
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "t"
    WHITESPACE "\n  "
    ALTER_COLUMN
      ALTER_KW "alter"
      WHITESPACE " "
      NAME_REF
        IDENT "c"
      WHITESPACE " "
      SET_OPTIONS
        SET_KW "set"
        WHITESPACE " "
        ATTRIBUTE_LIST
          L_PAREN "("
          ATTRIBUTE_OPTION
            NAME
              IDENT "a"
          COMMA ","
          WHITESPACE " "
          ERROR
            COMMA ","
          WHITESPACE " "
          ATTRIBUTE_OPTION
            NAME
              IDENT "b"
            WHITESPACE " "
            EQ "="
            WHITESPACE " "
            ATTRIBUTE_VALUE
              LITERAL
                INT_NUMBER "1"
          R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n"
---
error[syntax-error]: expected command, found ADD_KW
  ╭▸ 
2 │ add column foo boolean;
  ╰╴━
error[syntax-error]: expected command, found COLUMN_KW
  ╭▸ 
2 │ add column foo boolean;
  ╰╴    ━
error[syntax-error]: expected command, found IDENT
  ╭▸ 
2 │ add column foo boolean;
  ╰╴           ━
error[syntax-error]: expected command, found BOOLEAN_KW
  ╭▸ 
2 │ add column foo boolean;
  ╰╴               ━
error[syntax-error]: missing comma
  ╭▸ 
8 │ validate constraint foo validate constraint b ;
  ╰╴                       ━
error[syntax-error]: expected COMMA
   ╭▸ 
16 │   alter c set (a b = 1);
   ╰╴                ━
error[syntax-error]: unexpected comma
   ╭▸ 
20 │   alter c set (a, , b = 1);
   ╰╴                  ━
