aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Rowley <drowley@postgresql.org>2022-10-14 14:32:00 +1300
committerDavid Rowley <drowley@postgresql.org>2022-10-14 14:32:00 +1300
commit39b8c293fcde1d845da4d7127a25d41df53faab5 (patch)
tree1d4aee48087aae47ff121909d7ffcb829bd9d120
parentba185d318dd34ed3e860b3a19869fbc15007db8f (diff)
downloadpostgresql-39b8c293fcde1d845da4d7127a25d41df53faab5.tar.gz
postgresql-39b8c293fcde1d845da4d7127a25d41df53faab5.zip
Fix incorrect comment regarding command completion tags
The comment talked about some Asserts which did not exist and also a variable name which seems to have long since disappeared. Rewrite the comment in a way that will hopefully stand the test of time and inform people why we always write "INSERT 0 <nrows>" instead of "INSERT <nrows>" in the command completion tag for INSERT. Reviewed-by: Mark Dilger Discussion: https://postgr.es/m/CAApHDvpiUg09AvvGAVopNAKemA9z-kCmt7Fi6HKauc32bKzx4w@mail.gmail.com
-rw-r--r--src/backend/tcop/dest.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/backend/tcop/dest.c b/src/backend/tcop/dest.c
index c952cbea8bd..6afaa153cad 100644
--- a/src/backend/tcop/dest.c
+++ b/src/backend/tcop/dest.c
@@ -178,17 +178,18 @@ EndCommand(const QueryCompletion *qc, CommandDest dest, bool force_undecorated_o
/*
* We assume the tagname is plain ASCII and therefore requires no
* encoding conversion.
- *
- * We no longer display LastOid, but to preserve the wire
- * protocol, we write InvalidOid where the LastOid used to be
- * written.
- *
- * All cases where LastOid was written also write nprocessed
- * count, so just Assert that rather than having an extra test.
*/
tag = qc->commandTag;
tagname = GetCommandTagName(tag);
+ /*
+ * In PostgreSQL versions 11 and earlier, it was possible to
+ * create a table WITH OIDS. When inserting into such a table,
+ * INSERT used to include the Oid of the inserted record in the
+ * completion tag. To maintain compatibility in the wire
+ * protocol, we now write a "0" (for InvalidOid) in the location
+ * where we once wrote the new record's Oid.
+ */
if (command_tag_display_rowcount(tag) && !force_undecorated_output)
snprintf(completionTag, COMPLETION_TAG_BUFSIZE,
tag == CMDTAG_INSERT ?