defGetBoolean - Fix comment
Peter Smith <smithpb2250@gmail.com>
From: Peter Smith <smithpb2250@gmail.com>
To: PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Date: 2022-07-06T23:53:01Z
Lists: pgsql-hackers
Attachments
- v1-0001-Fix-comment-in-defGetBoolean.patch (application/octet-stream) patch v1-0001
Hi.
IMO the comment ("If no parameter given, ...") is a bit misleading:
====
(gdb) list
108 defGetBoolean(DefElem *def)
109 {
110 /*
111 * If no parameter given, assume "true" is meant.
112 */
113 if (def->arg == NULL)
114 return true;
115
116 /*
117 * Allow 0, 1, "true", "false", "on", "off"
(gdb) p *def
$9 = {type = T_DefElem, defnamespace = 0x0, defname = 0x1c177a8
"copy_data", arg = 0x0,
defaction = DEFELEM_UNSPEC, location = 93}
(gdb)
====
Really this code is for the case when there *was* a parameter given
(e.g. "copy_data" in my example above) but when there is no parameter
*value* given.
Suggested comment fix:
BEFORE
If no parameter given, assume "true" is meant.
AFTER
If no parameter value given, assume "true" is meant.
~~
Although it seems a trivial point, the motivation is that the above
code has been adapted (cut/paste) by multiple other WIP patches [1][2]
that I'm aware of, and so this original (misleading) comment is now
spreading to other places.
PSA patch to tweak both the original comment and another place it
already spread to.
------
[1] https://www.postgresql.org/message-id/flat/CALDaNm0gwjY_4HFxvvty01BOT01q_fJLKQ3pWP9%3D9orqubhjcQ%40mail.gmail.com
+static char
+defGetStreamingMode(DefElem *def)
[2] https://www.postgresql.org/message-id/flat/CAHut%2BPs%2B4iLzJGkPFEatv%3D%2Baa6NUB38-WT050RFKeJqhdcLaGA%40mail.gmail.com#6d43277cbb074071b8e9602ff8be7e41
+static CopyData
+DefGetCopyData(DefElem *def)
Kind Regards,
Peter Smith.
Fujitsu Australia
Commits
-
Improve two comments related to a boolean DefElem's value
- 8445f5a21d40 16.0 landed