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

25 lines
12 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="#format-framework" title="Format framework">Format framework</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="#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-691">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="format-framework"><a class="doc-anchor" href="#format-framework">§</a>Format framework</h2>
<p>Each COPY data format is implemented as a <a href="codec/trait.CopyInCodec.html" title="trait servers::postgres::copy_in::codec::CopyInCodec"><code>codec::CopyInCodec</code></a>: a
stateless strategy that validates its options at statement-parse time,
describes the column types it can ingest, and creates the stateful
record parser for one stream. Formats register a builder under every
accepted <code>FORMAT</code> name in <a href="constant.REGISTERED_FORMATS.html" title="constant servers::postgres::copy_in::REGISTERED_FORMATS"><code>REGISTERED_FORMATS</code></a> — <code>csv</code> is the only
implemented format today; PostgreSQL’s <code>text</code>/<code>binary</code> and
GreptimeDB-specific formats alike can be added the same way. 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="codec/index.html" title="mod servers::postgres::copy_in::codec">codec</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>The COPY FROM STDIN codec framework.</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="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="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></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.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="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.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. <code>csv</code> is the only implemented format; the others are
registered so they 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.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_codec.html" title="fn servers::postgres::copy_in::resolve_codec">resolve_<wbr>codec</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Resolves the format codec from the parsed options.</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_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.CodecBuilder.html" title="type servers::postgres::copy_in::CodecBuilder">Codec<wbr>Builder</a><span title="Restricted Visibility">&nbsp;🔒</span> </dt><dd>Builds a codec from the format-neutral option set.</dd></dl></section></div></main></body></html>