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
csvformat β currently the only implemented COPY FROM STDIN format. - influxdb π
- The
influxdbline protocol format for COPY FROM STDIN. - options π
- Format-neutral collection of COPY
WITH (...)options. - otlp π
- The
otlpformat for COPY FROM STDIN: one binary OTLP payload for any of the three signals βExportMetricsServiceRequest,ExportTraceServiceRequestorExportLogsServiceRequest. - parse π
- Textual parser for
COPY ... FROM STDINstatements.
StructsΒ§
- Copy
From πStdin - The parsed
COPY tbl [(columns)] FROM STDIN [(options)]statement. - Copy
InState π - 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
FORMATname to builder.csvis 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 STDINstatement 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Β§
- Format
Builder π - Builds a format from the format-neutral option set.