Files
greptimedb/servers/postgres/copy_in/index.html
T

36 lines
15 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="PostgreSQL `COPY ... FROM STDIN` (copy-in) support."><title>servers::postgres::copy_in - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../../static.files/rustdoc-1ed95124.css"><meta name="rustdoc-vars" data-root-path="../../../" data-static-root-path="../../../static.files/" data-current-crate="servers" data-themes="" data-resource-suffix="" data-rustdoc-version="1.98.1 (48a229cea 2026-09-01)" data-channel="1.98.1" data-search-js="search-9944d736.js" data-stringdex-js="stringdex-2da4960a.js" data-settings-js="settings-170eb4bf.js" ><script src="../../../static.files/storage-41dd4d93.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../../static.files/main-417ebf0a.js"></script><noscript><link rel="stylesheet" href="../../../static.files/noscript-f7c3ffd8.css"></noscript><link rel="alternate icon" type="image/png" href="../../../static.files/favicon-32x32-eab170b8.png"><link rel="icon" type="image/svg+xml" href="../../../static.files/favicon-044be391.svg"></head><body class="rustdoc mod"><a class="skip-main-content" href="#main-content">Skip to main content</a><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module copy_in</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><h2><a href="../../../servers/index.html">servers</a><span class="version">1.4.0-alpha.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module copy_in</a></h2><h3><a href="#">Sections</a></h3><ul class="block top-toc"><li><a href="#formats" title="Formats">Formats</a></li></ul><h3><a href="#modules">Module Items</a></h3><ul class="block"><li><a href="#modules" title="Modules">Modules</a></li><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#enums" title="Enums">Enums</a></li><li><a href="#constants" title="Constants">Constants</a></li><li><a href="#functions" title="Functions">Functions</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li></ul></section><div id="rustdoc-modnav"><h2><a href="../index.html">In servers::<wbr>postgres</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content" tabindex="-1"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../../index.html">servers</a>::<wbr><a href="../index.html">postgres</a></div><h1>Module <span>copy_in</span>&nbsp;<button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../../src/servers/postgres/copy_in/mod.rs.html#15-1584">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>PostgreSQL <code>COPY ... FROM STDIN</code> (copy-in) support.</p>
<p>The wire handshake is driven by pgwire: returning [<code>Response::CopyIn</code>]
from a query handler makes the server send a <code>CopyInResponse</code> and enter
the copy-in sub-protocol; subsequent <code>CopyData</code> messages from the client
are dispatched to [<code>CopyHandler</code>], whose implementation below parses
the data stream incrementally and flushes it into the query handler as
[<code>RowInsertRequests</code>] batches.</p>
<h2 id="formats"><a class="doc-anchor" href="#formats">§</a>Formats</h2>
<p>The supported formats are the explicit <a href="codec/enum.CopyFormat.html" title="enum servers::postgres::copy_in::codec::CopyFormat"><code>codec::CopyFormat</code></a> enum —
<code>csv</code> (table-bound, incremental row parsing) and <code>influxdb</code>
(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 <code>FORMAT</code> name (and its aliases) through
<a href="constant.REGISTERED_FORMATS.html" title="constant servers::postgres::copy_in::REGISTERED_FORMATS"><code>REGISTERED_FORMATS</code></a>. See the <code>codec</code> module docs.</p>
</div></details><h2 id="modules" class="section-header">Modules<a href="#modules" class="anchor">§</a></h2><dl class="item-table"><dt><a class="mod" href="arrow/index.html" title="mod servers::postgres::copy_in::arrow">arrow</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Standard Arrow IPC streams over COPY, using Flight’s bulk ingestion core.</dd><dt><a class="mod" href="codec/index.html" title="mod servers::postgres::copy_in::codec">codec</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>The COPY FROM STDIN formats.</dd><dt><a class="mod" href="csv/index.html" title="mod servers::postgres::copy_in::csv">csv</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>The <code>csv</code> format — currently the only implemented COPY FROM STDIN
format.</dd><dt><a class="mod" href="influxdb/index.html" title="mod servers::postgres::copy_in::influxdb">influxdb</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>The <code>influxdb</code> line protocol format for COPY FROM STDIN.</dd><dt><a class="mod" href="jsonl/index.html" title="mod servers::postgres::copy_in::jsonl">jsonl</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>The <code>jsonl</code> format: newline-delimited JSON objects, one per record.</dd><dt><a class="mod" href="options/index.html" title="mod servers::postgres::copy_in::options">options</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Format-neutral collection of COPY <code>WITH (...)</code> options.</dd><dt><a class="mod" href="otlp/index.html" title="mod servers::postgres::copy_in::otlp">otlp</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>The <code>otlp</code> format for COPY FROM STDIN: one binary OTLP payload for
any of the three signals — <code>ExportMetricsServiceRequest</code>,
<code>ExportTraceServiceRequest</code> or <code>ExportLogsServiceRequest</code>.</dd><dt><a class="mod" href="parse/index.html" title="mod servers::postgres::copy_in::parse">parse</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Textual parser for <code>COPY ... FROM STDIN</code> statements.</dd><dt><a class="mod" href="prom_write/index.html" title="mod servers::postgres::copy_in::prom_write">prom_<wbr>write</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>The <code>promwrite</code> format for COPY FROM STDIN: one Prometheus Remote
Write request body (v1 or v2), snappy- or zstd-compressed protobuf.</dd></dl><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">§</a></h2><dl class="item-table"><dt><a class="struct" href="struct.BufferedReservation.html" title="struct servers::postgres::copy_in::BufferedReservation">Buffered<wbr>Reservation</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>The receive-stage reservation for one buffered payload, handed to
the flush that consumes the payload: the guards must outlive the
payload’s bytes (they may coexist with the decode buffer or wait on
decode quota), and <code>charged_bytes</code> is the payload’s pre-charged
reservation to hand to decode-side fits checks.</dd><dt><a class="struct" href="struct.CopyFromStdin.html" title="struct servers::postgres::copy_in::CopyFromStdin">Copy<wbr>From<wbr>Stdin</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>The parsed <code>COPY tbl [(columns)] FROM STDIN [(options)]</code> statement.</dd><dt><a class="struct" href="struct.CopyInState.html" title="struct servers::postgres::copy_in::CopyInState">Copy<wbr>InState</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Per-connection state of an in-progress COPY FROM STDIN.</dd></dl><h2 id="enums" class="section-header">Enums<a href="#enums" class="anchor">§</a></h2><dl class="item-table"><dt><a class="enum" href="enum.Payload.html" title="enum servers::postgres::copy_in::Payload">Payload</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt></dl><h2 id="constants" class="section-header">Constants<a href="#constants" class="anchor">§</a></h2><dl class="item-table"><dt><a class="constant" href="constant.COPY_IN_FLUSH_ROWS.html" title="constant servers::postgres::copy_in::COPY_IN_FLUSH_ROWS">COPY_<wbr>IN_<wbr>FLUSH_<wbr>ROWS</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Number of parsed rows buffered before flushing a batch to the handler.</dd><dt><a class="constant" href="constant.COPY_IN_MAX_PAYLOAD_BYTES.html" title="constant servers::postgres::copy_in::COPY_IN_MAX_PAYLOAD_BYTES">COPY_<wbr>IN_<wbr>MAX_<wbr>PAYLOAD_<wbr>BYTES</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>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.</dd><dt><a class="constant" href="constant.REGISTERED_FORMATS.html" title="constant servers::postgres::copy_in::REGISTERED_FORMATS">REGISTERED_<wbr>FORMATS</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>The registered COPY FROM STDIN formats: accepted <code>FORMAT</code> name to
builder. Unimplemented PostgreSQL text/binary formats are registered
to report a clear “not supported yet” instead of an unknown-format error.</dd></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">§</a></h2><dl class="item-table"><dt><a class="fn" href="fn.adjust_query_context.html" title="fn servers::postgres::copy_in::adjust_query_context">adjust_<wbr>query_<wbr>context</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="fn" href="fn.all_rejected_error.html" title="fn servers::postgres::copy_in::all_rejected_error">all_<wbr>rejected_<wbr>error</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>The error for an OTLP payload whose points/spans were all rejected,
carrying the pipeline’s reason when it provided one.</dd><dt><a class="fn" href="fn.bad_copy_data.html" title="fn servers::postgres::copy_in::bad_copy_data">bad_<wbr>copy_<wbr>data</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="fn" href="fn.build_grpc_column_schema.html" title="fn servers::postgres::copy_in::build_grpc_column_schema">build_<wbr>grpc_<wbr>column_<wbr>schema</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="fn" href="fn.build_unimplemented_binary_codec.html" title="fn servers::postgres::copy_in::build_unimplemented_binary_codec">build_<wbr>unimplemented_<wbr>binary_<wbr>codec</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="fn" href="fn.build_unimplemented_text_codec.html" title="fn servers::postgres::copy_in::build_unimplemented_text_codec">build_<wbr>unimplemented_<wbr>text_<wbr>codec</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="fn" href="fn.copy_from_stdin_from_sql.html" title="fn servers::postgres::copy_in::copy_from_stdin_from_sql">copy_<wbr>from_<wbr>stdin_<wbr>from_<wbr>sql</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Parses a leading <code>COPY ... FROM STDIN</code> statement from SQL text.</dd><dt><a class="fn" href="fn.copy_in_error.html" title="fn servers::postgres::copy_in::copy_in_error">copy_<wbr>in_<wbr>error</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="fn" href="fn.copy_in_must_run_alone_error.html" title="fn servers::postgres::copy_in::copy_in_must_run_alone_error">copy_<wbr>in_<wbr>must_<wbr>run_<wbr>alone_<wbr>error</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="fn" href="fn.invalid_text_repr.html" title="fn servers::postgres::copy_in::invalid_text_repr">invalid_<wbr>text_<wbr>repr</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="fn" href="fn.is_copy_from_stdin.html" title="fn servers::postgres::copy_in::is_copy_from_stdin">is_<wbr>copy_<wbr>from_<wbr>stdin</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Whether an already-parsed statement is a <code>COPY ... FROM STDIN</code>; used to
reject copy-in statements trailing other statements, where the textual
scanner (which only sees statement-leading COPYs) does not see them.</dd><dt><a class="fn" href="fn.resolve_columns.html" title="fn servers::postgres::copy_in::resolve_columns">resolve_<wbr>columns</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dt><a class="fn" href="fn.resolve_format.html" title="fn servers::postgres::copy_in::resolve_format">resolve_<wbr>format</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Resolves the format from the parsed options.</dd><dt><a class="fn" href="fn.resolve_otlp_target.html" title="fn servers::postgres::copy_in::resolve_otlp_target">resolve_<wbr>otlp_<wbr>target</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Resolves the SQL target’s scope and supplies a fallback destination
for logs/traces. The explicit WITH table_name option takes precedence
over the SQL target’s name, but does not override its catalog/schema.</dd><dt><a class="fn" href="fn.resolve_table_name.html" title="fn servers::postgres::copy_in::resolve_table_name">resolve_<wbr>table_<wbr>name</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Resolves table name parts against the query context defaults.</dd><dt><a class="fn" href="fn.semantic_type_of.html" title="fn servers::postgres::copy_in::semantic_type_of">semantic_<wbr>type_<wbr>of</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Derives a column’s semantic type the same way the flow adapter does
(<code>flow::adapter::util::column_schemas_to_proto</code>): the time-index flag
for timestamps, primary-key membership for tags.</dd><dt><a class="fn" href="fn.unsupported.html" title="fn servers::postgres::copy_in::unsupported">unsupported</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt></dl><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">§</a></h2><dl class="item-table"><dt><a class="type" href="type.FormatBuilder.html" title="type servers::postgres::copy_in::FormatBuilder">Format<wbr>Builder</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Builds a format from the format-neutral option set.</dd></dl></section></div></main></body></html>