Re: [BUG FIX] Uninitialized var fargtypes used.
От
Alvaro Herrera
Тема
Re: [BUG FIX] Uninitialized var fargtypes used.
Дата
Msg-id
20191112140129.GA7283@alvherre.pgsql
Ответ на
Re: [BUG FIX] Uninitialized var fargtypes used. (Kyotaro Horiguchi)
Список
Дерево обсуждения
[BUG FIX] Uninitialized var fargtypes used. Ranier Vilela <ranier_gyn@hotmail.com>
Re: [BUG FIX] Uninitialized var fargtypes used. Tom Lane <tgl@sss.pgh.pa.us>
Re: [BUG FIX] Uninitialized var fargtypes used. Kyotaro Horiguchi <horikyota.ntt@gmail.com>
Re: [BUG FIX] Uninitialized var fargtypes used. Alvaro Herrera <alvherre@2ndquadrant.com>
Re: [BUG FIX] Uninitialized var fargtypes used. Tom Lane <tgl@sss.pgh.pa.us>
Re: [BUG FIX] Uninitialized var fargtypes used. Alvaro Herrera <alvherre@2ndquadrant.com>
Re: [BUG FIX] Uninitialized var fargtypes used. Tom Lane <tgl@sss.pgh.pa.us>
Re: [BUG FIX] Uninitialized var fargtypes used. Kyotaro Horiguchi <horikyota.ntt@gmail.com>
On 2019-Nov-12, Kyotaro Horiguchi wrote:
> At Mon, 11 Nov 2019 12:32:38 -0500, Tom Lane wrote in
> > /*
> > * If no arguments were specified, the name must yield a unique candidate.
> > */
> > if (nargs < 0)
> > {
>
> We can change the condition with "nargs <= 0" and it should return the
> only element in clist. If the catalog is broken we may get
> FUNCLOOKUP_AMBIGUOUS but it seems rather the correct behavior.
>
> This allows argtypes == NULL and makes the caller-side tweak useless.
Yeah, essentially this reverts 0a52d378b03b. Here's another version of
this I wrote last night.
BTW I also noticed that ProcedureCreate forces its callers to pass a
non-NULL parameterTypes even for 0 args, which seems to be fixed easily
too, something like this:
diff --git a/src/backend/catalog/pg_proc.c b/src/backend/catalog/pg_proc.c
index ef009ad2bc..547949e534 100644
--- a/src/backend/catalog/pg_proc.c
+++ b/src/backend/catalog/pg_proc.c
@@ -124,7 +124,7 @@ ProcedureCreate(const char *procedureName,
*/
Assert(PointerIsValid(prosrc));
- parameterCount = parameterTypes->dim1;
+ parameterCount = parameterTypes == NULL ? 0 : parameterTypes->dim1;
if (parameterCount < 0 || parameterCount > FUNC_MAX_ARGS)
ereport(ERROR,
(errcode(ERRCODE_TOO_MANY_ARGUMENTS),
--
Álvaro Herrera https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
В списке pgsql-bugs по дате отправления
От: Arseny Sher
Дата:
От: Marcos David
Дата: