Re: [HACKERS] Adding support for Default partition in partitioning
От | Jeevan Ladhe |
---|---|
Тема | Re: [HACKERS] Adding support for Default partition in partitioning |
Дата | |
Msg-id | CAOgcT0NDp-E_Q1vM456Oidrbr80DfSeJ51dN8bTSC38my3JOrw@mail.gmail.com обсуждение исходный текст |
Ответ на | Re: [HACKERS] Adding support for Default partition in partitioning (Rahila Syed <rahilasyed90@gmail.com>) |
Список | pgsql-hackers |
Hi Rahila,
On Thu, May 11, 2017 at 7:37 PM, Rahila Syed <rahilasyed90@gmail.com> wrote:
>3.>In following function isDefaultPartitionBound, first statement "return false">is not needed.It is needed to return false if the node is not DefElem.
Please have a look at following code:
+ * Returns true if the partition bound is default
+ */
+bool
+isDefaultPartitionBound(Node *value)
+{
+ if (IsA(value, DefElem))
+ {
+ DefElem defvalue = (DefElem ) value;
+ if(!strcmp(defvalue->defname, "DEFAULT"))
+ return true;
+ return false;
+ }
+ return false;
+}
By first return false, I mean to say the return statement inside the
if block "if (IsA(value, DefElem))":
+ if(!strcmp(defvalue->defname, "DEFAULT"))
+ return true;
+ return false;
Even if this "return false" is not present, the control is anyway going to
fall through and will return false from the outermost return statement.
I leave this decision to you, but further this block could be rewritten as
below and also can be defined as a macro:
bool
isDefaultPartitionBound(Node *value)
{
return (IsA(value, DefElem) &&
!strcmp(((DefElem) value)->defname, "DEFAULT"));
}
Regards,
Jeevan Ladhe
В списке pgsql-hackers по дате отправления: