* This is the sending counterpart of NextCopyFromExecute. Used in the QD, * to send a row to a QE. */
| 3859 | * to send a row to a QE. |
| 3860 | */ |
| 3861 | static void |
| 3862 | SendCopyFromForwardedTuple(CopyFromState cstate, |
| 3863 | CdbCopy *cdbCopy, |
| 3864 | bool toAll, |
| 3865 | int target_seg, |
| 3866 | Relation rel, |
| 3867 | int64 lineno, |
| 3868 | char *line, |
| 3869 | int line_len, |
| 3870 | Datum *values, |
| 3871 | bool *nulls, |
| 3872 | bool is_directory_table) |
| 3873 | { |
| 3874 | TupleDesc tupDesc; |
| 3875 | FormData_pg_attribute *attr; |
| 3876 | copy_from_dispatch_row *frame; |
| 3877 | StringInfo msgbuf; |
| 3878 | int num_sent_fields; |
| 3879 | AttrNumber num_phys_attrs; |
| 3880 | int i; |
| 3881 | |
| 3882 | if (!OidIsValid(RelationGetRelid(rel))) |
| 3883 | elog(ERROR, "invalid target table OID in COPY"); |
| 3884 | |
| 3885 | if (!is_directory_table) |
| 3886 | { |
| 3887 | tupDesc = RelationGetDescr(rel); |
| 3888 | } |
| 3889 | else |
| 3890 | { |
| 3891 | tupDesc = CreateTemplateTupleDesc(5); |
| 3892 | TupleDescInitEntry(tupDesc, (AttrNumber) 1, "relative_path", |
| 3893 | TEXTOID, -1, 0); |
| 3894 | TupleDescInitEntry(tupDesc, (AttrNumber) 2, "size", |
| 3895 | INT8OID, -1, 0); |
| 3896 | TupleDescInitEntry(tupDesc, (AttrNumber) 3, "last_modified", |
| 3897 | TIMESTAMPTZOID, -1, 0); |
| 3898 | TupleDescInitEntry(tupDesc, (AttrNumber) 4, "md5", |
| 3899 | TEXTOID, -1, 0); |
| 3900 | TupleDescInitEntry(tupDesc, (AttrNumber) 5, "tag", |
| 3901 | TEXTOID, -1 ,0); |
| 3902 | } |
| 3903 | attr = tupDesc->attrs; |
| 3904 | num_phys_attrs = tupDesc->natts; |
| 3905 | |
| 3906 | /* |
| 3907 | * Reset the message buffer, and reserve enough space for the header, |
| 3908 | * the OID if any, and the residual line. |
| 3909 | */ |
| 3910 | msgbuf = cstate->dispatch_msgbuf; |
| 3911 | ENLARGE_MSGBUF(msgbuf, SizeOfCopyFromDispatchRow + sizeof(Oid) + cstate->line_buf.len); |
| 3912 | |
| 3913 | /* the header goes to the beginning of the struct, but it will be filled in later. */ |
| 3914 | msgbuf->len = SizeOfCopyFromDispatchRow; |
| 3915 | |
| 3916 | /* |
| 3917 | * Next, any residual text that we didn't process in the QD. |
| 3918 | */ |
no test coverage detected