aboutsummaryrefslogtreecommitdiff
path: root/src/backend/backup/basebackup_copy.c
diff options
context:
space:
mode:
authorNathan Bossart <nathan@postgresql.org>2023-08-22 19:16:12 -0700
committerNathan Bossart <nathan@postgresql.org>2023-08-22 19:16:12 -0700
commitf4b54e1ed9853ab9aff524494866823f951b1e7f (patch)
treed828a0aceba5a1e74372170b58c97bae56eeefa3 /src/backend/backup/basebackup_copy.c
parent711479115836b2180f50c00bbf0773220848a7f5 (diff)
downloadpostgresql-f4b54e1ed9853ab9aff524494866823f951b1e7f.tar.gz
postgresql-f4b54e1ed9853ab9aff524494866823f951b1e7f.zip
Introduce macros for protocol characters.
This commit introduces descriptively-named macros for the identifiers used in wire protocol messages. These new macros are placed in a new header file so that they can be easily used by third-party code. Author: Dave Cramer Reviewed-by: Alvaro Herrera, Tatsuo Ishii, Peter Smith, Robert Haas, Tom Lane, Peter Eisentraut, Michael Paquier Discussion: https://postgr.es/m/CADK3HHKbBmK-PKf1bPNFoMC%2BoBt%2BpD9PH8h5nvmBQskEHm-Ehw%40mail.gmail.com
Diffstat (limited to 'src/backend/backup/basebackup_copy.c')
-rw-r--r--src/backend/backup/basebackup_copy.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/backend/backup/basebackup_copy.c b/src/backend/backup/basebackup_copy.c
index 1db80cde1b2..fee30c21e10 100644
--- a/src/backend/backup/basebackup_copy.c
+++ b/src/backend/backup/basebackup_copy.c
@@ -152,7 +152,7 @@ bbsink_copystream_begin_backup(bbsink *sink)
SendTablespaceList(state->tablespaces);
/* Send a CommandComplete message */
- pq_puttextmessage('C', "SELECT");
+ pq_puttextmessage(PqMsg_CommandComplete, "SELECT");
/* Begin COPY stream. This will be used for all archives + manifest. */
SendCopyOutResponse();
@@ -169,7 +169,7 @@ bbsink_copystream_begin_archive(bbsink *sink, const char *archive_name)
StringInfoData buf;
ti = list_nth(state->tablespaces, state->tablespace_num);
- pq_beginmessage(&buf, 'd'); /* CopyData */
+ pq_beginmessage(&buf, PqMsg_CopyData);
pq_sendbyte(&buf, 'n'); /* New archive */
pq_sendstring(&buf, archive_name);
pq_sendstring(&buf, ti->path == NULL ? "" : ti->path);
@@ -220,7 +220,7 @@ bbsink_copystream_archive_contents(bbsink *sink, size_t len)
{
mysink->last_progress_report_time = now;
- pq_beginmessage(&buf, 'd'); /* CopyData */
+ pq_beginmessage(&buf, PqMsg_CopyData);
pq_sendbyte(&buf, 'p'); /* Progress report */
pq_sendint64(&buf, state->bytes_done);
pq_endmessage(&buf);
@@ -246,7 +246,7 @@ bbsink_copystream_end_archive(bbsink *sink)
mysink->bytes_done_at_last_time_check = state->bytes_done;
mysink->last_progress_report_time = GetCurrentTimestamp();
- pq_beginmessage(&buf, 'd'); /* CopyData */
+ pq_beginmessage(&buf, PqMsg_CopyData);
pq_sendbyte(&buf, 'p'); /* Progress report */
pq_sendint64(&buf, state->bytes_done);
pq_endmessage(&buf);
@@ -261,7 +261,7 @@ bbsink_copystream_begin_manifest(bbsink *sink)
{
StringInfoData buf;
- pq_beginmessage(&buf, 'd'); /* CopyData */
+ pq_beginmessage(&buf, PqMsg_CopyData);
pq_sendbyte(&buf, 'm'); /* Manifest */
pq_endmessage(&buf);
}
@@ -318,7 +318,7 @@ SendCopyOutResponse(void)
{
StringInfoData buf;
- pq_beginmessage(&buf, 'H');
+ pq_beginmessage(&buf, PqMsg_CopyOutResponse);
pq_sendbyte(&buf, 0); /* overall format */
pq_sendint16(&buf, 0); /* natts */
pq_endmessage(&buf);
@@ -330,7 +330,7 @@ SendCopyOutResponse(void)
static void
SendCopyDone(void)
{
- pq_putemptymessage('c');
+ pq_putemptymessage(PqMsg_CopyDone);
}
/*
@@ -368,7 +368,7 @@ SendXlogRecPtrResult(XLogRecPtr ptr, TimeLineID tli)
end_tup_output(tstate);
/* Send a CommandComplete message */
- pq_puttextmessage('C', "SELECT");
+ pq_puttextmessage(PqMsg_CommandComplete, "SELECT");
}
/*