Skip to main content

Module parse

Module parse 

Source
Expand description

Textual parser for COPY ... FROM STDIN statements.

COPY FROM STDIN is parsed here instead of through sqlparser because the WITH (...) option list is open: formats may accept options beyond sqlparserโ€™s COPY grammar (for example a line-protocol format taking precision), and unknown options must reach the format codec rather than fail statement parsing.

The parser commits to error reporting only after FROM STDIN has been seen; anything else (like COPY ... TO STDOUT) is reported as CopyInScan::NotCopyIn so the caller falls back to the regular SQL path.

Structsยง

RawCopyFromStdin ๐Ÿ”’
A scanned COPY tbl [(cols)] FROM STDIN [WITH (...)] statement.
Tokens ๐Ÿ”’

Enumsยง

CopyInScan ๐Ÿ”’

Functionsยง

expect_ident ๐Ÿ”’
Returns the identifier with the SQL parserโ€™s canonicalization: quoted identifiers keep their case, unquoted ones fold to lowercase.
parse_column_list ๐Ÿ”’
Parses an optional (column, ...) list. None means the statement is not a copy-in shape (either no list, or a malformed list better left to the regular parser to report).
parse_object_name ๐Ÿ”’
parse_option_list ๐Ÿ”’
Parses NAME [value] (, NAME [value])* until the closing ).
scan_copy_from_stdin ๐Ÿ”’
Scans a SQL string for a leading COPY ... FROM STDIN statement.