---
source: crates/squawk_parser/tests/tests.rs
input_file: crates/squawk_parser/tests/data/ok/copy.sql
---
SOURCE_FILE
  COMMENT "-- simple_copy_from"
  WHITESPACE "\n"
  COPY
    COPY_KW "copy"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME_REF
          IDENT "copytest"
    WHITESPACE " "
    FROM_KW "from"
    WHITESPACE " "
    LITERAL
      STRING "'/tmp/copy.data'"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- copy_to"
  WHITESPACE "\n"
  COPY
    COPY_KW "COPY"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME_REF
          IDENT "country"
    WHITESPACE " "
    TO_KW "TO"
    WHITESPACE " "
    STDOUT_KW "STDOUT"
    WHITESPACE " "
    COPY_OPTION_LIST
      L_PAREN "("
      COPY_OPTION
        NAME
          DELIMITER_KW "DELIMITER"
        WHITESPACE " "
        LITERAL
          STRING "'|'"
      R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- copy_from"
  WHITESPACE "\n"
  COPY
    COPY_KW "COPY"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME_REF
          IDENT "country"
    WHITESPACE " "
    FROM_KW "FROM"
    WHITESPACE " "
    LITERAL
      STRING "'/usr1/proj/bray/sql/country_data'"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- copy_to_file"
  WHITESPACE "\n"
  COPY
    COPY_KW "COPY"
    WHITESPACE " "
    L_PAREN "("
    SELECT
      SELECT_CLAUSE
        SELECT_KW "SELECT"
        WHITESPACE " "
        TARGET_LIST
          TARGET
            STAR "*"
      WHITESPACE " "
      FROM_CLAUSE
        FROM_KW "FROM"
        WHITESPACE " "
        FROM_ITEM
          NAME_REF
            IDENT "country"
      WHITESPACE " "
      WHERE_CLAUSE
        WHERE_KW "WHERE"
        WHITESPACE " "
        BIN_EXPR
          NAME_REF
            IDENT "country_name"
          WHITESPACE " "
          LIKE_KW "LIKE"
          WHITESPACE " "
          LITERAL
            STRING "'A%'"
    R_PAREN ")"
    WHITESPACE " "
    TO_KW "TO"
    WHITESPACE " "
    LITERAL
      STRING "'/usr1/proj/bray/sql/a_list_countries.copy'"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- copy_to_compress_filed"
  WHITESPACE "\n"
  COPY
    COPY_KW "COPY"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME_REF
          IDENT "country"
    WHITESPACE " "
    TO_KW "TO"
    WHITESPACE " "
    PROGRAM_KW "PROGRAM"
    WHITESPACE " "
    LITERAL
      STRING "'gzip > /usr1/proj/bray/sql/country_data.gz'"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- log_setting"
  WHITESPACE "\n"
  COPY
    COPY_KW "copy"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME_REF
          IDENT "x"
    WHITESPACE " "
    COLUMN_LIST
      L_PAREN "("
      COLUMN
        NAME_REF
          IDENT "i"
      COMMA ","
      WHITESPACE " "
      COLUMN
        NAME_REF
          IDENT "y"
      R_PAREN ")"
    WHITESPACE " "
    FROM_KW "from"
    WHITESPACE " "
    LITERAL
      STRING "'/tmp/input.file'"
    WHITESPACE " "
    COPY_OPTION_LIST
      L_PAREN "("
      WHITESPACE " "
      COPY_OPTION
        NAME
          IDENT "on_error"
        WHITESPACE " "
        IGNORE_KW "ignore"
      COMMA ","
      WHITESPACE " "
      COPY_OPTION
        NAME
          IDENT "log_verbosity"
        WHITESPACE " "
        VERBOSE_KW "verbose"
      WHITESPACE " "
      R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- on_error"
  WHITESPACE "\n"
  COPY
    COPY_KW "copy"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME_REF
          IDENT "copytest"
    WHITESPACE " "
    FROM_KW "from"
    WHITESPACE " "
    LITERAL
      STRING "'/tmp/copy.data'"
    WHITESPACE " "
    COPY_OPTION_LIST
      L_PAREN "("
      WHITESPACE " "
      COPY_OPTION
        NAME
          IDENT "on_error"
        WHITESPACE " "
        IGNORE_KW "ignore"
      WHITESPACE " "
      R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- all_the_options"
  WHITESPACE "\n"
  COPY
    COPY_KW "copy"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME_REF
          IDENT "t"
    WHITESPACE " "
    FROM_KW "from"
    WHITESPACE " "
    LITERAL
      STRING "'foo'"
    WHITESPACE " "
    COPY_OPTION_LIST
      L_PAREN "("
      WHITESPACE "\n  "
      COPY_OPTION
        NAME
          FORMAT_KW "format"
        WHITESPACE " "
        CSV_KW "csv"
      COMMA ","
      WHITESPACE "\n  "
      COPY_OPTION
        NAME
          FREEZE_KW "freeze"
      COMMA ","
      WHITESPACE "\n  "
      COPY_OPTION
        NAME
          FREEZE_KW "freeze"
        WHITESPACE " "
        LITERAL
          TRUE_KW "true"
      COMMA ","
      WHITESPACE "\n  "
      COPY_OPTION
        NAME
          FREEZE_KW "freeze"
        WHITESPACE " "
        LITERAL
          FALSE_KW "false"
      COMMA ","
      WHITESPACE "\n  "
      COPY_OPTION
        NAME
          DELIMITER_KW "delimiter"
        WHITESPACE " "
        LITERAL
          STRING "','"
      COMMA ","
      WHITESPACE "\n  "
      COPY_OPTION
        NAME
          NULL_KW "null"
        WHITESPACE " "
        LITERAL
          STRING "'\\n'"
      COMMA ","
      WHITESPACE "\n  "
      COPY_OPTION
        NAME
          DEFAULT_KW "default"
        WHITESPACE " "
        LITERAL
          STRING "'foo'"
      COMMA ","
      WHITESPACE "\n  "
      COPY_OPTION
        NAME
          HEADER_KW "header"
      COMMA ","
      WHITESPACE "\n  "
      COPY_OPTION
        NAME
          HEADER_KW "header"
        WHITESPACE " "
        LITERAL
          TRUE_KW "true"
      COMMA ","
      WHITESPACE "\n  "
      COPY_OPTION
        NAME
          HEADER_KW "header"
        WHITESPACE " "
        LITERAL
          FALSE_KW "false"
      COMMA ","
      WHITESPACE "\n  "
      COPY_OPTION
        NAME
          HEADER_KW "header"
        WHITESPACE " "
        MATCH_KW "match"
      COMMA ","
      WHITESPACE "\n  "
      COPY_OPTION
        NAME
          QUOTE_KW "quote"
        WHITESPACE " "
        LITERAL
          STRING "'foo'"
      COMMA ","
      WHITESPACE "\n  "
      COPY_OPTION
        NAME
          ESCAPE_KW "escape"
        WHITESPACE " "
        LITERAL
          STRING "'bar'"
      COMMA ","
      WHITESPACE "\n  "
      COPY_OPTION
        NAME
          IDENT "force_quote"
        WHITESPACE " "
        STAR "*"
      COMMA ","
      WHITESPACE "\n  "
      COPY_OPTION
        NAME
          IDENT "force_quote"
        WHITESPACE " "
        COPY_OPTION_LIST
          L_PAREN "("
          COPY_OPTION
            NAME
              IDENT "a"
          COMMA ","
          WHITESPACE " "
          COPY_OPTION
            NAME
              IDENT "b"
          COMMA ","
          WHITESPACE " "
          COPY_OPTION
            NAME
              IDENT "c"
          COMMA ","
          WHITESPACE " "
          COPY_OPTION
            NAME
              IDENT "d"
          R_PAREN ")"
      COMMA ","
      WHITESPACE "\n  "
      COPY_OPTION
        NAME
          IDENT "force_not_null"
        WHITESPACE " "
        STAR "*"
      COMMA ","
      WHITESPACE "\n  "
      COPY_OPTION
        NAME
          IDENT "force_not_null"
        WHITESPACE " "
        COPY_OPTION_LIST
          L_PAREN "("
          COPY_OPTION
            NAME
              IDENT "a"
          R_PAREN ")"
      COMMA ","
      WHITESPACE "\n  "
      COPY_OPTION
        NAME
          IDENT "force_null"
        WHITESPACE " "
        STAR "*"
      COMMA ","
      WHITESPACE "\n  "
      COPY_OPTION
        NAME
          IDENT "force_null"
        WHITESPACE " "
        COPY_OPTION_LIST
          L_PAREN "("
          COPY_OPTION
            NAME
              IDENT "a"
          COMMA ","
          WHITESPACE " "
          COPY_OPTION
            NAME
              IDENT "b"
          R_PAREN ")"
      COMMA ","
      WHITESPACE "\n  "
      COPY_OPTION
        NAME
          IDENT "on_error"
        WHITESPACE " "
        IDENT "stop"
      COMMA ","
      WHITESPACE "\n  "
      COPY_OPTION
        NAME
          IDENT "on_error"
        WHITESPACE " "
        IGNORE_KW "ignore"
      COMMA ","
      WHITESPACE "\n  "
      COPY_OPTION
        NAME
          ENCODING_KW "encoding"
        WHITESPACE " "
        LITERAL
          STRING "'utf8'"
      COMMA ","
      WHITESPACE "\n  "
      COPY_OPTION
        NAME
          IDENT "log_verbosity"
        WHITESPACE " "
        VERBOSE_KW "verbose"
      WHITESPACE "\n"
      R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
