Re: Refactor textToQualifiedNameList()

From: Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>
To: nagata(at)sraoss(dot)co(dot)jp
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Refactor textToQualifiedNameList()
Date: 2018-08-28 02:49:26
Views: Raw Message | Whole Thread | Download mbox
Lists: pgsql-hackers


At Fri, 24 Aug 2018 20:44:12 +0900, Yugo Nagata <nagata(at)sraoss(dot)co(dot)jp> wrote in <20180824204412(dot)150979ae6b283ddb639f93f6(at)sraoss(dot)co(dot)jp>
> When working on other patch[1], I found there are almost same
> functions, texttoQualifiedNameList() and stringToQualifiedNameList().
> The only difference is the argument type, text or char*. I don't know
> why these functions are defined seperately, but I think the former
> function can be rewritten using the latter code as the attached patch.
> Is this reasonable fix?

The functions were introduced within a month for different
objectives in March and April, 2002. I supppose that they are
intentionally added as separate functions for simplicitly since
the second one is apparent CnP'ed from the first one.

commit 5f4745adf4fb2a1f933b25d7a2bc72b39fa9edfd
commit 52200befd04b9fa71da83231c808764867079226

Returning to the patch, the downside of it is that textToQNL
makes an extra and unused copy of the parameter string. (It's a
kind of bug that it is forgetting to free rawname.)

Maybe we can separate them into three functions (or one function
and two macros) to get rid of the duplication but I'm not sure
it's worth doing..


Kyotaro Horiguchi
NTT Open Source Software Center

In response to


Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2018-08-28 03:41:25 Re: Why hash OIDs?
Previous Message Thomas Munro 2018-08-28 02:45:49 Re: Why hash OIDs?