Skip to main content

Module copy_in

Module copy_in 

Source
Expand description

PostgreSQL COPY ... FROM STDIN (copy-in) support.

The wire handshake is driven by pgwire: returning [Response::CopyIn] from a query handler makes the server send a CopyInResponse and enter the copy-in sub-protocol; subsequent CopyData messages from the client are dispatched to [CopyHandler], whose implementation below parses the data stream incrementally and flushes it into the query handler as [RowInsertRequests] batches.

Β§Formats

The supported formats are the explicit codec::CopyFormat enum β€” csv (table-bound, incremental row parsing) and influxdb (table-less, one bounded whole-payload request). Each format states its own target rule and ingestion shape in the match arms of the copy lifecycle below; adding a format is a new variant plus its arms. Builders resolve a FORMAT name (and its aliases) through REGISTERED_FORMATS. See the codec module docs.

ModulesΒ§

codec πŸ”’
The COPY FROM STDIN formats.
csv πŸ”’
The csv format β€” currently the only implemented COPY FROM STDIN format.
influxdb πŸ”’
The influxdb line protocol format for COPY FROM STDIN.
options πŸ”’
Format-neutral collection of COPY WITH (...) options.
otlp πŸ”’
The otlp format for COPY FROM STDIN: one binary OTLP payload for any of the three signals β€” ExportMetricsServiceRequest, ExportTraceServiceRequest or ExportLogsServiceRequest.
parse πŸ”’
Textual parser for COPY ... FROM STDIN statements.

StructsΒ§

CopyFromStdin πŸ”’
The parsed COPY tbl [(columns)] FROM STDIN [(options)] statement.
CopyInState πŸ”’
Per-connection state of an in-progress COPY FROM STDIN.

EnumsΒ§

Payload πŸ”’

ConstantsΒ§

COPY_IN_FLUSH_ROWS πŸ”’
Number of parsed rows buffered before flushing a batch to the handler.
COPY_IN_MAX_PAYLOAD_BYTES πŸ”’
Upper bound of a table-less COPY FROM STDIN payload (influxdb line protocol, OTLP). One COPY statement is one bounded ingestion request (the whole payload is buffered like one HTTP request body); a larger import is multiple COPY statements.
REGISTERED_FORMATS πŸ”’
The registered COPY FROM STDIN formats: accepted FORMAT name to builder. csv is the only implemented format; the others are registered so they report a clear β€œnot supported yet” instead of an unknown-format error.

FunctionsΒ§

adjust_query_context πŸ”’
all_rejected_error πŸ”’
The error for an OTLP payload whose points/spans were all rejected, carrying the pipeline’s reason when it provided one.
bad_copy_data πŸ”’
build_grpc_column_schema πŸ”’
build_unimplemented_binary_codec πŸ”’
build_unimplemented_text_codec πŸ”’
copy_from_stdin_from_sql πŸ”’
Parses a leading COPY ... FROM STDIN statement from SQL text.
copy_in_error πŸ”’
copy_in_must_run_alone_error πŸ”’
invalid_text_repr πŸ”’
is_copy_from_stdin πŸ”’
Whether an already-parsed statement is a COPY ... FROM STDIN; used to reject copy-in statements trailing other statements, where the textual scanner (which only sees statement-leading COPYs) does not see them.
resolve_columns πŸ”’
resolve_format πŸ”’
Resolves the format from the parsed options.
resolve_table_name πŸ”’
Resolves table name parts against the query context defaults.
semantic_type_of πŸ”’
Derives a column’s semantic type the same way the flow adapter does (flow::adapter::util::column_schemas_to_proto): the time-index flag for timestamps, primary-key membership for tags.
unsupported πŸ”’

Type AliasesΒ§

FormatBuilder πŸ”’
Builds a format from the format-neutral option set.