Hi, 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?
Regards, -- Yugo Nagata <nag...@sraoss.co.jp>
diff --git a/src/backend/utils/adt/varlena.c b/src/backend/utils/adt/varlena.c index a5e812d026..2ef1a1e330 100644 --- a/src/backend/utils/adt/varlena.c +++ b/src/backend/utils/adt/varlena.c @@ -34,6 +34,7 @@ #include "utils/memutils.h" #include "utils/pg_locale.h" #include "utils/sortsupport.h" +#include "utils/regproc.h" #include "utils/varlena.h" @@ -3233,34 +3234,12 @@ textToQualifiedNameList(text *textval) { char *rawname; List *result = NIL; - List *namelist; - ListCell *l; /* Convert to C string (handles possible detoasting). */ /* Note we rely on being able to modify rawname below. */ rawname = text_to_cstring(textval); - if (!SplitIdentifierString(rawname, '.', &namelist)) - ereport(ERROR, - (errcode(ERRCODE_INVALID_NAME), - errmsg("invalid name syntax"))); - - if (namelist == NIL) - ereport(ERROR, - (errcode(ERRCODE_INVALID_NAME), - errmsg("invalid name syntax"))); - - foreach(l, namelist) - { - char *curname = (char *) lfirst(l); - - result = lappend(result, makeString(pstrdup(curname))); - } - - pfree(rawname); - list_free(namelist); - - return result; + return stringToQualifiedNameList(rawname); } /*