/* *RepresentstheinsertmethodtobeusedduringCOPYFROM.
*/ typedefenum CopyInsertMethod
{
CIM_SINGLE, /* use table_tuple_insert or ExecForeignInsert */
CIM_MULTI, /* always use table_multi_insert or
* ExecForeignBatchInsert */
CIM_MULTI_CONDITIONAL, /* use table_multi_insert or
* ExecForeignBatchInsert only if valid */
} CopyInsertMethod;
/* low-level state data */
CopySource copy_src; /* type of copy source */
FILE *copy_file; /* used if copy_src == COPY_FILE */
StringInfo fe_msgbuf; /* used if copy_src == COPY_FRONTEND */
EolType eol_type; /* EOL type of input */ int file_encoding; /* file or remote side's character encoding */ bool need_transcoding; /* file encoding diff from server? */
Oid conversion_proc; /* encoding conversion function */
/* parameters from the COPY command */
Relation rel; /* relation to copy from */
List *attnumlist; /* integer list of attnums to copy */ char *filename; /* filename, or NULL for STDIN */ bool is_program; /* is 'filename' a program to popen? */
copy_data_source_cb data_source_cb; /* function for reading data */
/* these are just for error messages, see CopyFromErrorCallback */ constchar *cur_relname; /* table name for error messages */
uint64 cur_lineno; /* line number for error messages */ constchar *cur_attname; /* current att for error messages */ constchar *cur_attval; /* current att value for error messages */ bool relname_only; /* don't output line number, att, etc. */
AttrNumber num_defaults; /* count of att that are missing and have
* default value */
FmgrInfo *in_functions; /* array of input functions for each attrs */
Oid *typioparams; /* array of element types for in_functions */
ErrorSaveContext *escontext; /* soft error trapped during in_functions
* execution */
uint64 num_errors; /* total number of rows which contained soft
* errors */ int *defmap; /* array of default att numbers related to
* missing att */
ExprState **defexprs; /* array of default att expressions for all
* att */ bool *defaults; /* if DEFAULT marker was found for
* corresponding att */ bool volatile_defexprs; /* is any of defexprs volatile? */
List *range_table; /* single element list of RangeTblEntry */
List *rteperminfos; /* single element list of RTEPermissionInfo */
ExprState *qualexpr;
/* *Similarly,line_bufholdsthewholeinputlinebeingprocessed.The *inputcycleisfirsttoreadthewholelineintoline_buf,andthen *extracttheindividualattributefieldsintoattribute_buf.line_buf *ispreservedunmodifiedsothatwecandisplayitinerrormessagesif *appropriate.(Inbinarymode,line_bufisnotused.)
*/
StringInfoData line_buf; bool line_buf_valid; /* contains the row being processed? */
/* *input_bufholdsinputdata,alreadyconvertedtodatabaseencoding. * *Intextmode,CopyReadLineparsesthisdatasufficientlytolocateline *boundaries,thentransfersthedatatoline_buf.Weguaranteethat *thereisa\0atinput_buf[input_buf_len]atalltimes.(Inbinary *mode,input_bufisnotused.) * *Ifencodingconversionisnotrequired,input_bufisnotaseparate *bufferbutpointsdirectlytoraw_buf.Inthatcase,input_buf_len *tracksthenumberofbytesthathavebeenverifiedasvalidinthe *databaseencoding,andraw_buf_lenisthetotalnumberofbytesstored *inthebuffer.
*/ #define INPUT_BUF_SIZE 65536/* we palloc INPUT_BUF_SIZE+1 bytes */ char *input_buf; int input_buf_index; /* next byte to process */ int input_buf_len; /* total # of bytes stored */ bool input_reached_eof; /* true if we reached EOF */ bool input_reached_error; /* true if a conversion error happened */ /* Shorthand for number of unconsumed bytes available in input_buf */ #define INPUT_BUF_BYTES(cstate) ((cstate)->input_buf_len - (cstate)->input_buf_index)
/* *raw_bufholdsrawinputdatareadfromthedatasource(fileorclient *connection),notyetconvertedtothedatabaseencoding.Likewith *'input_buf',weguaranteethatthereisa\0atraw_buf[raw_buf_len].
*/ #define RAW_BUF_SIZE 65536/* we palloc RAW_BUF_SIZE+1 bytes */ char *raw_buf; int raw_buf_index; /* next byte to process */ int raw_buf_len; /* total # of bytes stored */ bool raw_reached_eof; /* true if we reached EOF */
/* Shorthand for number of unconsumed bytes available in raw_buf */ #define RAW_BUF_BYTES(cstate) ((cstate)->raw_buf_len - (cstate)->raw_buf_index)
uint64 bytes_processed; /* number of bytes processed so far */
} CopyFromStateData;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.