1/*-------------------------------------------------------------------------
2 *
3 * copy.h
4 * Definitions for using the POSTGRES copy command.
5 *
6 *
7 * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group
8 * Portions Copyright (c) 1994, Regents of the University of California
9 *
10 * src/include/commands/copy.h
11 *
12 *-------------------------------------------------------------------------
13 */
14#ifndef COPY_H
15#define COPY_H
16
17#include "nodes/execnodes.h"
18#include "nodes/parsenodes.h"
19#include "parser/parse_node.h"
20#include "tcop/dest.h"
21
22/* CopyStateData is private in commands/copy.c */
23typedef struct CopyStateData *CopyState;
24typedef int (*copy_data_source_cb) (void *outbuf, int minread, int maxread);
25
26extern void DoCopy(ParseState *state, const CopyStmt *stmt,
27 int stmt_location, int stmt_len,
28 uint64 *processed);
29
30extern void ProcessCopyOptions(ParseState *pstate, CopyState cstate, bool is_from, List *options);
31extern CopyState BeginCopyFrom(ParseState *pstate, Relation rel, const char *filename,
32 bool is_program, copy_data_source_cb data_source_cb, List *attnamelist, List *options);
33extern void EndCopyFrom(CopyState cstate);
34extern bool NextCopyFrom(CopyState cstate, ExprContext *econtext,
35 Datum *values, bool *nulls);
36extern bool NextCopyFromRawFields(CopyState cstate,
37 char ***fields, int *nfields);
38extern void CopyFromErrorCallback(void *arg);
39
40extern uint64 CopyFrom(CopyState cstate);
41
42extern DestReceiver *CreateCopyDestReceiver(void);
43
44#endif /* COPY_H */
45