Skip to content

Commit 39b8c29

Browse files
committed
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
1 parent ba185d3 commit 39b8c29

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

src/backend/tcop/dest.c

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,17 +178,18 @@ EndCommand(const QueryCompletion *qc, CommandDest dest, bool force_undecorated_o
178178
/*
179179
* We assume the tagname is plain ASCII and therefore requires no
180180
* encoding conversion.
181-
*
182-
* We no longer display LastOid, but to preserve the wire
183-
* protocol, we write InvalidOid where the LastOid used to be
184-
* written.
185-
*
186-
* All cases where LastOid was written also write nprocessed
187-
* count, so just Assert that rather than having an extra test.
188181
*/
189182
tag = qc->commandTag;
190183
tagname = GetCommandTagName(tag);
191184

185+
/*
186+
* In PostgreSQL versions 11 and earlier, it was possible to
187+
* create a table WITH OIDS. When inserting into such a table,
188+
* INSERT used to include the Oid of the inserted record in the
189+
* completion tag. To maintain compatibility in the wire
190+
* protocol, we now write a "0" (for InvalidOid) in the location
191+
* where we once wrote the new record's Oid.
192+
*/
192193
if (command_tag_display_rowcount(tag) && !force_undecorated_output)
193194
snprintf(completionTag, COMPLETION_TAG_BUFSIZE,
194195
tag == CMDTAG_INSERT ?

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy