Re: Refactor textToQualifiedNameList() - Mailing list pgsql-hackers

From Kyotaro HORIGUCHI
Subject Re: Refactor textToQualifiedNameList()
Date
Msg-id 20180828.114926.121449868.horiguchi.kyotaro@lab.ntt.co.jp
Whole thread Raw
In response to Refactor textToQualifiedNameList()  (Yugo Nagata <nagata@sraoss.co.jp>)
Responses Re: Refactor textToQualifiedNameList()
List pgsql-hackers
Hello.

At Fri, 24 Aug 2018 20:44:12 +0900, Yugo Nagata <nagata@sraoss.co.jp> wrote in
<20180824204412.150979ae6b283ddb639f93f6@sraoss.co.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..

regards.

-- 
Kyotaro Horiguchi
NTT Open Source Software Center



pgsql-hackers by date:

Previous
From: Thomas Munro
Date:
Subject: Re: Why hash OIDs?
Next
From: Andres Freund
Date:
Subject: Re: Why hash OIDs?