1996-07-09 08:22:35 +02:00
|
|
|
/*-------------------------------------------------------------------------
|
|
|
|
*
|
1999-02-14 00:22:53 +01:00
|
|
|
* copy.h
|
1997-09-07 07:04:48 +02:00
|
|
|
* Definitions for using the POSTGRES copy command.
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
|
|
|
*
|
2016-01-02 19:33:40 +01:00
|
|
|
* Portions Copyright (c) 1996-2016, PostgreSQL Global Development Group
|
2000-01-26 06:58:53 +01:00
|
|
|
* Portions Copyright (c) 1994, Regents of the University of California
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
2010-09-20 22:08:53 +02:00
|
|
|
* src/include/commands/copy.h
|
1996-07-09 08:22:35 +02:00
|
|
|
*
|
|
|
|
*-------------------------------------------------------------------------
|
|
|
|
*/
|
|
|
|
#ifndef COPY_H
|
1997-09-07 07:04:48 +02:00
|
|
|
#define COPY_H
|
1996-07-09 08:22:35 +02:00
|
|
|
|
2011-02-16 03:19:11 +01:00
|
|
|
#include "nodes/execnodes.h"
|
2011-09-04 07:13:16 +02:00
|
|
|
#include "nodes/parsenodes.h"
|
|
|
|
#include "tcop/dest.h"
|
2002-03-29 20:06:29 +01:00
|
|
|
|
2011-02-20 20:06:59 +01:00
|
|
|
/* CopyStateData is private in commands/copy.c */
|
|
|
|
typedef struct CopyStateData *CopyState;
|
2011-02-16 03:19:11 +01:00
|
|
|
|
2012-12-29 13:55:37 +01:00
|
|
|
extern Oid DoCopy(const CopyStmt *stmt, const char *queryString,
|
2013-05-29 22:58:43 +02:00
|
|
|
uint64 *processed);
|
2001-10-28 07:26:15 +01:00
|
|
|
|
2011-02-20 20:06:59 +01:00
|
|
|
extern void ProcessCopyOptions(CopyState cstate, bool is_from, List *options);
|
2011-02-16 03:19:11 +01:00
|
|
|
extern CopyState BeginCopyFrom(Relation rel, const char *filename,
|
Add support for piping COPY to/from an external program.
This includes backend "COPY TO/FROM PROGRAM '...'" syntax, and corresponding
psql \copy syntax. Like with reading/writing files, the backend version is
superuser-only, and in the psql version, the program is run in the client.
In the passing, the psql \copy STDIN/STDOUT syntax is subtly changed: if you
the stdin/stdout is quoted, it's now interpreted as a filename. For example,
"\copy foo from 'stdin'" now reads from a file called 'stdin', not from
standard input. Before this, there was no way to specify a filename called
stdin, stdout, pstdin or pstdout.
This creates a new function in pgport, wait_result_to_str(), which can
be used to convert the exit status of a process, as returned by wait(3),
to a human-readable string.
Etsuro Fujita, reviewed by Amit Kapila.
2013-02-27 17:17:21 +01:00
|
|
|
bool is_program, List *attnamelist, List *options);
|
2011-02-16 03:19:11 +01:00
|
|
|
extern void EndCopyFrom(CopyState cstate);
|
|
|
|
extern bool NextCopyFrom(CopyState cstate, ExprContext *econtext,
|
2011-04-10 17:42:00 +02:00
|
|
|
Datum *values, bool *nulls, Oid *tupleOid);
|
2011-02-16 03:19:11 +01:00
|
|
|
extern bool NextCopyFromRawFields(CopyState cstate,
|
2011-04-10 17:42:00 +02:00
|
|
|
char ***fields, int *nfields);
|
2011-02-16 03:19:11 +01:00
|
|
|
extern void CopyFromErrorCallback(void *arg);
|
|
|
|
|
2006-08-31 01:34:22 +02:00
|
|
|
extern DestReceiver *CreateCopyDestReceiver(void);
|
|
|
|
|
2001-11-05 18:46:40 +01:00
|
|
|
#endif /* COPY_H */
|