1/*-------------------------------------------------------------------------
4 * API for COPY TO/FROM handlers
7 * Portions Copyright (c) 1996-2025, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
10 * src/include/commands/copyapi.h
12 *-------------------------------------------------------------------------
20 * API structure for a COPY TO format implementation. Note this must be
21 * allocated in a server-lifetime manner, typically as a static const struct.
26 * Set output function information. This callback is called once at the
27 * beginning of COPY TO.
29 * 'finfo' can be optionally filled to provide the catalog information of
30 * the output function.
32 * 'atttypid' is the OID of data type used by the relation's attribute.
38 * Start a COPY TO. This callback is called once at the beginning of COPY
41 * 'tupDesc' is the tuple descriptor of the relation from where the data
47 * Write one row stored in 'slot' to the destination.
52 * End a COPY TO. This callback is called once at the end of COPY TO.
58 * API structure for a COPY FROM format implementation. Note this must be
59 * allocated in a server-lifetime manner, typically as a static const struct.
64 * Set input function information. This callback is called once at the
65 * beginning of COPY FROM.
67 * 'finfo' can be optionally filled to provide the catalog information of
70 * 'typioparam' can be optionally filled to define the OID of the type to
71 * pass to the input function.'atttypid' is the OID of data type used by
72 * the relation's attribute.
78 * Start a COPY FROM. This callback is called once at the beginning of
81 * 'tupDesc' is the tuple descriptor of the relation where the data needs
82 * to be copied. This can be used for any initialization steps required by
88 * Read one row from the source and fill *values and *nulls.
90 * 'econtext' is used to evaluate default expression for each column that
91 * is either not read from the file or is using the DEFAULT option of COPY
92 * FROM. It is NULL if no default values are used.
94 * Returns false if there are no more tuples to read.
100 * End a COPY FROM. This callback is called once at the end of COPY FROM.
105#endif /* COPYAPI_H */
static Datum values[MAXATTR]
struct CopyFromRoutine CopyFromRoutine
struct CopyToRoutine CopyToRoutine
void(* CopyFromEnd)(CopyFromState cstate)
void(* CopyFromInFunc)(CopyFromState cstate, Oid atttypid, FmgrInfo *finfo, Oid *typioparam)
bool(* CopyFromOneRow)(CopyFromState cstate, ExprContext *econtext, Datum *values, bool *nulls)
void(* CopyFromStart)(CopyFromState cstate, TupleDesc tupDesc)
void(* CopyToOutFunc)(CopyToState cstate, Oid atttypid, FmgrInfo *finfo)
void(* CopyToOneRow)(CopyToState cstate, TupleTableSlot *slot)
void(* CopyToEnd)(CopyToState cstate)
void(* CopyToStart)(CopyToState cstate, TupleDesc tupDesc)