---
source: crates/squawk_parser/tests/tests.rs
input_file: crates/squawk_parser/tests/data/ok/create_foreign_table.sql
---
SOURCE_FILE
  COMMENT "-- simple"
  WHITESPACE "\n"
  CREATE_FOREIGN_TABLE
    CREATE_KW "create"
    WHITESPACE " "
    FOREIGN_KW "foreign"
    WHITESPACE " "
    TABLE_KW "table"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME
          IDENT "t"
    TABLE_ARG_LIST
      L_PAREN "("
      R_PAREN ")"
    WHITESPACE "\n  "
    SERVER_NAME
      SERVER_KW "server"
      WHITESPACE " "
      NAME_REF
        IDENT "s"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- full"
  WHITESPACE "\n"
  CREATE_FOREIGN_TABLE
    CREATE_KW "create"
    WHITESPACE " "
    FOREIGN_KW "foreign"
    WHITESPACE " "
    TABLE_KW "table"
    WHITESPACE " "
    IF_NOT_EXISTS
      IF_KW "if"
      WHITESPACE " "
      NOT_KW "not"
      WHITESPACE " "
      EXISTS_KW "exists"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME
          IDENT "t"
    TABLE_ARG_LIST
      L_PAREN "("
      WHITESPACE "\n  "
      COLUMN
        NAME
          IDENT "a"
        WHITESPACE " "
        PATH_TYPE
          PATH
            PATH_SEGMENT
              NAME_REF
                TEXT_KW "text"
      COMMA ","
      WHITESPACE " \n  "
      COLUMN
        NAME
          IDENT "b"
        WHITESPACE " "
        PATH_TYPE
          PATH
            PATH
              PATH_SEGMENT
                NAME_REF
                  IDENT "foo"
            DOT "."
            PATH_SEGMENT
              NAME_REF
                BIGINT_KW "bigint"
        WHITESPACE " \n    "
        ALTER_OPTION_LIST
          OPTIONS_KW "options"
          WHITESPACE " "
          L_PAREN "("
          ALTER_OPTION
            NAME
              IDENT "a"
            WHITESPACE " "
            LITERAL
              STRING "'b'"
          COMMA ","
          WHITESPACE " "
          ALTER_OPTION
            NAME
              IDENT "c"
            WHITESPACE " "
            LITERAL
              STRING "'d'"
          R_PAREN ")"
        WHITESPACE " \n    "
        COLLATE
          COLLATE_KW "collate"
          WHITESPACE " "
          PATH
            PATH_SEGMENT
              NAME_REF
                IDENT "\"fr_FR\""
        WHITESPACE "\n    "
        NOT_NULL_CONSTRAINT
          CONSTRAINT_NAME
            CONSTRAINT_KW "constraint"
            WHITESPACE " "
            NAME
              IDENT "c"
          WHITESPACE "\n    "
          NOT_KW "not"
          WHITESPACE " "
          NULL_KW "null"
        WHITESPACE "\n    "
        NULL_CONSTRAINT
          NULL_KW "null"
        WHITESPACE "\n    "
        CHECK_CONSTRAINT
          CHECK_KW "check"
          WHITESPACE " "
          L_PAREN "("
          BIN_EXPR
            NAME_REF
              IDENT "x"
            WHITESPACE " "
            R_ANGLE ">"
            WHITESPACE " "
            NAME_REF
              IDENT "b"
          R_PAREN ")"
          WHITESPACE " "
          NO_INHERIT
            NO_KW "no"
            WHITESPACE " "
            INHERIT_KW "inherit"
        WHITESPACE "\n    "
        DEFAULT_CONSTRAINT
          DEFAULT_KW "default"
          WHITESPACE " "
          BIN_EXPR
            LITERAL
              INT_NUMBER "10"
            WHITESPACE " "
            STAR "*"
            WHITESPACE " "
            LITERAL
              INT_NUMBER "2"
        WHITESPACE "\n    "
        GENERATED_CONSTRAINT
          GENERATED_KW "generated"
          WHITESPACE " "
          ALWAYS_KW "always"
          WHITESPACE " "
          AS_KW "as"
          WHITESPACE " "
          L_PAREN "("
          BIN_EXPR
            NAME_REF
              IDENT "x"
            WHITESPACE " "
            PLUS "+"
            WHITESPACE " "
            LITERAL
              INT_NUMBER "2"
          R_PAREN ")"
          WHITESPACE " "
          STORED_KW "stored"
      COMMA ","
      WHITESPACE "\n  "
      CHECK_CONSTRAINT
        CONSTRAINT_NAME
          CONSTRAINT_KW "constraint"
          WHITESPACE " "
          NAME
            IDENT "fooo"
        WHITESPACE "\n    "
        CHECK_KW "check"
        WHITESPACE " "
        L_PAREN "("
        BIN_EXPR
          NAME_REF
            IDENT "a"
          WHITESPACE " "
          R_ANGLE ">"
          WHITESPACE " "
          NAME_REF
            IDENT "b"
        R_PAREN ")"
      WHITESPACE "\n"
      R_PAREN ")"
    WHITESPACE "\n  "
    INHERITS
      INHERITS_KW "inherits"
      WHITESPACE " "
      L_PAREN "("
      PATH
        PATH
          PATH_SEGMENT
            NAME_REF
              IDENT "foo"
        DOT "."
        PATH_SEGMENT
          NAME_REF
            IDENT "bar"
      COMMA ","
      WHITESPACE " "
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "bar"
      R_PAREN ")"
    WHITESPACE "\n  "
    SERVER_NAME
      SERVER_KW "server"
      WHITESPACE " "
      NAME_REF
        IDENT "s"
    WHITESPACE "\n  "
    ALTER_OPTION_LIST
      OPTIONS_KW "options"
      WHITESPACE " "
      L_PAREN "("
      ALTER_OPTION
        NAME
          IDENT "a"
        WHITESPACE " "
        LITERAL
          STRING "'b'"
      COMMA ","
      WHITESPACE " "
      ALTER_OPTION
        NAME
          IDENT "c"
        WHITESPACE " "
        LITERAL
          STRING "'d'"
      R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- partitioned_simple"
  WHITESPACE "\n"
  CREATE_FOREIGN_TABLE
    CREATE_KW "create"
    WHITESPACE " "
    FOREIGN_KW "foreign"
    WHITESPACE " "
    TABLE_KW "table"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME
          IDENT "t"
    WHITESPACE " \n  "
    PARTITION_KW "partition"
    WHITESPACE " "
    OF_KW "of"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME_REF
          IDENT "u"
    WHITESPACE "\n    "
    PARTITION_DEFAULT
      DEFAULT_KW "default"
    WHITESPACE "\n    "
    SERVER_NAME
      SERVER_KW "server"
      WHITESPACE " "
      NAME_REF
        IDENT "s"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- partitioned"
  WHITESPACE "\n"
  CREATE_FOREIGN_TABLE
    CREATE_KW "create"
    WHITESPACE " "
    FOREIGN_KW "foreign"
    WHITESPACE " "
    TABLE_KW "table"
    WHITESPACE " "
    IF_NOT_EXISTS
      IF_KW "if"
      WHITESPACE " "
      NOT_KW "not"
      WHITESPACE " "
      EXISTS_KW "exists"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME
          IDENT "t"
    WHITESPACE " \n  "
    PARTITION_KW "partition"
    WHITESPACE " "
    OF_KW "of"
    WHITESPACE " "
    PATH
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "foo"
      DOT "."
      PATH_SEGMENT
        NAME_REF
          IDENT "u"
    TABLE_ARG_LIST
      L_PAREN "("
      WHITESPACE "\n    "
      COLUMN
        NAME
          IDENT "a"
        WHITESPACE " "
        WITH_OPTIONS
          WITH_KW "with"
          WHITESPACE " "
          OPTIONS_KW "options"
        WHITESPACE " "
        NOT_NULL_CONSTRAINT
          NOT_KW "not"
          WHITESPACE " "
          NULL_KW "null"
        WHITESPACE " "
        CHECK_CONSTRAINT
          CHECK_KW "check"
          WHITESPACE " "
          L_PAREN "("
          BIN_EXPR
            NAME_REF
              IDENT "a"
            WHITESPACE " "
            R_ANGLE ">"
            WHITESPACE " "
            LITERAL
              INT_NUMBER "10"
          R_PAREN ")"
      COMMA ","
      WHITESPACE "\n    "
      COLUMN
        NAME
          IDENT "b"
        WHITESPACE " "
        NULL_CONSTRAINT
          NULL_KW "null"
        WHITESPACE " "
        DEFAULT_CONSTRAINT
          DEFAULT_KW "default"
          WHITESPACE " "
          LITERAL
            STRING "'foo'"
      COMMA ","
      WHITESPACE "\n    "
      CHECK_CONSTRAINT
        CHECK_KW "check"
        WHITESPACE " "
        L_PAREN "("
        BIN_EXPR
          NAME_REF
            IDENT "a"
          WHITESPACE " "
          R_ANGLE ">"
          WHITESPACE " "
          NAME_REF
            IDENT "b"
        R_PAREN ")"
      WHITESPACE "\n  "
      R_PAREN ")"
    WHITESPACE "\n    "
    PARTITION_DEFAULT
      DEFAULT_KW "default"
    WHITESPACE "\n    "
    SERVER_NAME
      SERVER_KW "server"
      WHITESPACE " "
      NAME_REF
        IDENT "s"
    WHITESPACE "\n    "
    ALTER_OPTION_LIST
      OPTIONS_KW "options"
      WHITESPACE " "
      L_PAREN "("
      ALTER_OPTION
        NAME
          IDENT "a"
        WHITESPACE " "
        LITERAL
          STRING "'b'"
      COMMA ","
      WHITESPACE " "
      ALTER_OPTION
        NAME
          IDENT "c"
        WHITESPACE " "
        LITERAL
          STRING "'d'"
      R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- partitioned_bound_spec_in"
  WHITESPACE "\n"
  CREATE_FOREIGN_TABLE
    CREATE_KW "create"
    WHITESPACE " "
    FOREIGN_KW "foreign"
    WHITESPACE " "
    TABLE_KW "table"
    WHITESPACE " "
    IF_NOT_EXISTS
      IF_KW "if"
      WHITESPACE " "
      NOT_KW "not"
      WHITESPACE " "
      EXISTS_KW "exists"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME
          IDENT "t"
    WHITESPACE " \n  "
    PARTITION_KW "partition"
    WHITESPACE " "
    OF_KW "of"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME_REF
          IDENT "u"
    TABLE_ARG_LIST
      L_PAREN "("
      WHITESPACE "\n    "
      COLUMN
        NAME
          IDENT "a"
      WHITESPACE "\n  "
      R_PAREN ")"
    WHITESPACE "\n    "
    PARTITION_FOR_VALUES_IN
      FOR_KW "for"
      WHITESPACE " "
      VALUES_KW "values"
      WHITESPACE " "
      IN_KW "in"
      WHITESPACE " "
      L_PAREN "("
      BIN_EXPR
        NAME_REF
          IDENT "a"
        WHITESPACE " "
        R_ANGLE ">"
        WHITESPACE " "
        NAME_REF
          IDENT "b"
      R_PAREN ")"
    WHITESPACE "\n    "
    SERVER_NAME
      SERVER_KW "server"
      WHITESPACE " "
      NAME_REF
        IDENT "s"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- partitioned_bound_spec_from"
  WHITESPACE "\n"
  CREATE_FOREIGN_TABLE
    CREATE_KW "create"
    WHITESPACE " "
    FOREIGN_KW "foreign"
    WHITESPACE " "
    TABLE_KW "table"
    WHITESPACE " "
    IF_NOT_EXISTS
      IF_KW "if"
      WHITESPACE " "
      NOT_KW "not"
      WHITESPACE " "
      EXISTS_KW "exists"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME
          IDENT "t"
    WHITESPACE " \n  "
    PARTITION_KW "partition"
    WHITESPACE " "
    OF_KW "of"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME_REF
          IDENT "u"
    TABLE_ARG_LIST
      L_PAREN "("
      WHITESPACE "\n    "
      COLUMN
        NAME
          IDENT "a"
      WHITESPACE "\n  "
      R_PAREN ")"
    WHITESPACE "\n    "
    PARTITION_FOR_VALUES_FROM
      FOR_KW "for"
      WHITESPACE " "
      VALUES_KW "values"
      WHITESPACE " "
      FROM_KW "from"
      WHITESPACE " "
      L_PAREN "("
      BIN_EXPR
        NAME_REF
          IDENT "a"
        WHITESPACE " "
        R_ANGLE ">"
        WHITESPACE " "
        NAME_REF
          IDENT "b"
      COMMA ","
      WHITESPACE " "
      NAME_REF
        MINVALUE_KW "minvalue"
      COMMA ","
      WHITESPACE " "
      NAME_REF
        MAXVALUE_KW "maxvalue"
      R_PAREN ")"
      WHITESPACE " \n      "
      TO_KW "to"
      WHITESPACE " "
      L_PAREN "("
      NAME_REF
        MAXVALUE_KW "maxvalue"
      COMMA ","
      WHITESPACE " "
      NAME_REF
        MINVALUE_KW "minvalue"
      R_PAREN ")"
    WHITESPACE "\n    "
    SERVER_NAME
      SERVER_KW "server"
      WHITESPACE " "
      NAME_REF
        IDENT "s"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- partitioned_bound_spec_with"
  WHITESPACE "\n"
  CREATE_FOREIGN_TABLE
    CREATE_KW "create"
    WHITESPACE " "
    FOREIGN_KW "foreign"
    WHITESPACE " "
    TABLE_KW "table"
    WHITESPACE " "
    IF_NOT_EXISTS
      IF_KW "if"
      WHITESPACE " "
      NOT_KW "not"
      WHITESPACE " "
      EXISTS_KW "exists"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME
          IDENT "t"
    WHITESPACE " \n  "
    PARTITION_KW "partition"
    WHITESPACE " "
    OF_KW "of"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME_REF
          IDENT "u"
    TABLE_ARG_LIST
      L_PAREN "("
      WHITESPACE "\n    "
      COLUMN
        NAME
          IDENT "a"
      WHITESPACE "\n  "
      R_PAREN ")"
    WHITESPACE "\n    "
    PARTITION_FOR_VALUES_WITH
      FOR_KW "for"
      WHITESPACE " "
      VALUES_KW "values"
      WHITESPACE " "
      WITH_KW "with"
      WHITESPACE " "
      L_PAREN "("
      IDENT "modulus"
      WHITESPACE " "
      INT_NUMBER "10"
      COMMA ","
      WHITESPACE " "
      IDENT "remainder"
      WHITESPACE " "
      INT_NUMBER "2"
      R_PAREN ")"
    WHITESPACE "\n    "
    SERVER_NAME
      SERVER_KW "server"
      WHITESPACE " "
      NAME_REF
        IDENT "s"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- with schema"
  WHITESPACE "\n"
  CREATE_FOREIGN_TABLE
    CREATE_KW "create"
    WHITESPACE " "
    FOREIGN_KW "foreign"
    WHITESPACE " "
    TABLE_KW "table"
    WHITESPACE " "
    PATH
      PATH
        PATH_SEGMENT
          NAME_REF
            IDENT "cal"
      DOT "."
      PATH_SEGMENT
        NAME
          IDENT "event_types"
    WHITESPACE " "
    TABLE_ARG_LIST
      L_PAREN "("
      WHITESPACE "\n  "
      COLUMN
        NAME
          IDENT "attrs"
        WHITESPACE " "
        PATH_TYPE
          PATH
            PATH_SEGMENT
              NAME_REF
                IDENT "jsonb"
      WHITESPACE "\n"
      R_PAREN ")"
    WHITESPACE "\n  "
    SERVER_NAME
      SERVER_KW "server"
      WHITESPACE " "
      NAME_REF
        IDENT "cal_server"
    WHITESPACE "\n  "
    ALTER_OPTION_LIST
      OPTIONS_KW "options"
      WHITESPACE " "
      L_PAREN "("
      WHITESPACE "\n    "
      ALTER_OPTION
        NAME
          OBJECT_KW "object"
        WHITESPACE " "
        LITERAL
          STRING "'event-types'"
      WHITESPACE "\n  "
      R_PAREN ")"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- like clause is >=pg18"
  WHITESPACE "\n"
  CREATE_FOREIGN_TABLE
    CREATE_KW "create"
    WHITESPACE " "
    FOREIGN_KW "foreign"
    WHITESPACE " "
    TABLE_KW "table"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME
          IDENT "u"
    WHITESPACE " "
    TABLE_ARG_LIST
      L_PAREN "("
      WHITESPACE "\n  "
      LIKE_CLAUSE
        LIKE_KW "like"
        WHITESPACE " "
        PATH
          PATH_SEGMENT
            NAME_REF
              IDENT "t"
      WHITESPACE "\n"
      R_PAREN ")"
    WHITESPACE " "
    SERVER_NAME
      SERVER_KW "server"
      WHITESPACE " "
      NAME_REF
        IDENT "s"
  SEMICOLON ";"
  WHITESPACE "\n\n"
  COMMENT "-- like clause is >=pg18"
  WHITESPACE "\n"
  CREATE_FOREIGN_TABLE
    CREATE_KW "create"
    WHITESPACE " "
    FOREIGN_KW "foreign"
    WHITESPACE " "
    TABLE_KW "table"
    WHITESPACE " "
    PATH
      PATH_SEGMENT
        NAME
          IDENT "remote_users"
    WHITESPACE " "
    TABLE_ARG_LIST
      L_PAREN "("
      WHITESPACE "\n  "
      LIKE_CLAUSE
        LIKE_KW "like"
        WHITESPACE " "
        PATH
          PATH_SEGMENT
            NAME_REF
              IDENT "local_users"
        WHITESPACE "\n    "
        LIKE_OPTION
          INCLUDING_KW "including"
          WHITESPACE " "
          DEFAULTS_KW "defaults"
        WHITESPACE "\n    "
        LIKE_OPTION
          INCLUDING_KW "including"
          WHITESPACE " "
          CONSTRAINTS_KW "constraints"
        WHITESPACE "\n    "
        LIKE_OPTION
          EXCLUDING_KW "excluding"
          WHITESPACE " "
          GENERATED_KW "generated"
        WHITESPACE "\n    "
        LIKE_OPTION
          EXCLUDING_KW "excluding"
          WHITESPACE " "
          STATISTICS_KW "statistics"
        WHITESPACE "\n    "
        LIKE_OPTION
          EXCLUDING_KW "excluding"
          WHITESPACE " "
          ALL_KW "all"
      WHITESPACE "\n"
      R_PAREN ")"
    WHITESPACE " "
    SERVER_NAME
      SERVER_KW "server"
      WHITESPACE " "
      NAME_REF
        IDENT "remote_server"
  SEMICOLON ";"
  WHITESPACE "\n\n"
