defGetBoolean - Fix comment
От | Peter Smith |
---|---|
Тема | defGetBoolean - Fix comment |
Дата | |
Msg-id | CAHut+Pv0yWynWTmp4o34s0d98xVubys9fy=p0YXsZ5_sUcNnMw@mail.gmail.com обсуждение исходный текст |
Ответы |
Re: defGetBoolean - Fix comment
|
Список | pgsql-hackers |
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
Вложения
В списке pgsql-hackers по дате отправления: