Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 9effa55

Browse files
author
Amit Kapila
committed
Deduplicate handling of binary and text modes in logicalrep_read_tuple().
Author: Bharath Rupireddy Reviewed-by: Peter Smith Discussion: https://postgr.es/m/CALj2ACXdbq7kW_+bRrSGMsR6nefCvwbHBJ5J51mr3gFf7QysTA@mail.gmail.com
1 parent ce340e5 commit 9effa55

File tree

1 file changed

+6
-12
lines changed
  • src/backend/replication/logical

1 file changed

+6
-12
lines changed

src/backend/replication/logical/proto.c

+6-12
Original file line numberDiff line numberDiff line change
@@ -895,25 +895,19 @@ logicalrep_read_tuple(StringInfo in, LogicalRepTupleData *tuple)
895895
/* we don't receive the value of an unchanged column */
896896
break;
897897
case LOGICALREP_COLUMN_TEXT:
898-
len = pq_getmsgint(in, 4); /* read length */
899-
900-
/* and data */
901-
value->data = palloc(len + 1);
902-
pq_copymsgbytes(in, value->data, len);
903-
value->data[len] = '\0';
904-
/* make StringInfo fully valid */
905-
value->len = len;
906-
value->cursor = 0;
907-
value->maxlen = len;
908-
break;
909898
case LOGICALREP_COLUMN_BINARY:
910899
len = pq_getmsgint(in, 4); /* read length */
911900

912901
/* and data */
913902
value->data = palloc(len + 1);
914903
pq_copymsgbytes(in, value->data, len);
915-
/* not strictly necessary but per StringInfo practice */
904+
905+
/*
906+
* Not strictly necessary for LOGICALREP_COLUMN_BINARY, but
907+
* per StringInfo practice.
908+
*/
916909
value->data[len] = '\0';
910+
917911
/* make StringInfo fully valid */
918912
value->len = len;
919913
value->cursor = 0;

0 commit comments

Comments
 (0)