blob: 01ce7dbb07deea9f11300b7149dbb4ae63337d43 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
|
/*-------------------------------------------------------------------------
*
* remotecopy.h
* Routines for extension of COPY command for cluster management
*
*
* Copyright (c) 2010-2012 Postgres-XC Development Group
*
*
* IDENTIFICATION
* src/include/pgxc/remotecopy.h
*
*-------------------------------------------------------------------------
*/
#ifndef REMOTECOPY_H
#define REMOTECOPY_H
#include "nodes/parsenodes.h"
#include "pgxc/locator.h"
/*
* This contains the set of data necessary for remote COPY control.
*/
typedef struct RemoteCopyData {
/* COPY FROM/TO? */
bool is_from;
/*
* On Coordinator we need to rewrite query.
* While client may submit a copy command dealing with file, Datanodes
* always send/receive data to/from the Coordinator. So we can not use
* original statement and should rewrite statement, specifing STDIN/STDOUT
* as copy source or destination
*/
StringInfoData query_buf;
Locator *locator; /* the locator object */
Oid dist_type; /* data type of the distribution column */
/* Locator information */
RelationLocInfo *rel_loc; /* the locator key */
} RemoteCopyData;
/*
* List of all the options used for query deparse step
* As CopyStateData stays private in copy.c and in order not to
* make Postgres-XC code too much intrusive in PostgreSQL code,
* this intermediate structure is used primarily to generate remote
* COPY queries based on deparsed options.
*/
typedef struct RemoteCopyOptions {
bool rco_binary; /* binary format? */
bool rco_oids; /* include OIDs? */
bool rco_csv_mode; /* Comma Separated Value format? */
char *rco_delim; /* column delimiter (must be 1 byte) */
char *rco_null_print; /* NULL marker string (server encoding!) */
char *rco_quote; /* CSV quote char (must be 1 byte) */
char *rco_escape; /* CSV escape char (must be 1 byte) */
List *rco_force_quote; /* list of column names */
List *rco_force_notnull; /* list of column names */
} RemoteCopyOptions;
extern void RemoteCopy_BuildStatement(RemoteCopyData *state,
Relation rel,
RemoteCopyOptions *options,
List *attnamelist,
List *attnums);
extern void RemoteCopy_GetRelationLoc(RemoteCopyData *state,
Relation rel,
List *attnums);
extern RemoteCopyOptions *makeRemoteCopyOptions(void);
extern void FreeRemoteCopyData(RemoteCopyData *state);
extern void FreeRemoteCopyOptions(RemoteCopyOptions *options);
#endif
|