MCPcopy Create free account
hub / github.com/apache/cloudberry / pq_getmsgstring

Function pq_getmsgstring

src/backend/libpq/pqformat.c:580–601  ·  view source on GitHub ↗

-------------------------------- * pq_getmsgstring - get a null-terminated text string (with conversion) * * May return a pointer directly into the message buffer, or a pointer * to a palloc'd conversion result. * -------------------------------- */

Source from the content-addressed store, hash-verified

578 * --------------------------------
579 */
580const char *
581pq_getmsgstring(StringInfo msg)
582{
583 char *str;
584 int slen;
585
586 str = &msg->data[msg->cursor];
587
588 /*
589 * It's safe to use strlen() here because a StringInfo is guaranteed to
590 * have a trailing null byte. But check we found a null inside the
591 * message.
592 */
593 slen = strlen(str);
594 if (msg->cursor + slen >= msg->len)
595 ereport(ERROR,
596 (errcode(ERRCODE_PROTOCOL_VIOLATION),
597 errmsg("invalid string in message")));
598 msg->cursor += slen + 1;
599
600 return pg_client_to_server(str, slen);
601}
602
603/* --------------------------------
604 * pq_getmsgrawstring - get a null-terminated text string - NO conversion

Callers 11

exec_bind_messageFunction · 0.85
PostgresMainFunction · 0.85
tsvectorrecvFunction · 0.85
tsqueryrecvFunction · 0.85
CopyGetDataFunction · 0.85
ProcessBgwTaskFeedbackFunction · 0.85
logicalrep_read_originFunction · 0.85
logicalrep_read_relFunction · 0.85
logicalrep_read_typFunction · 0.85
logicalrep_read_attrsFunction · 0.85

Calls 3

pg_client_to_serverFunction · 0.85
errcodeFunction · 0.50
errmsgFunction · 0.50

Tested by

no test coverage detected