From: | Alvaro Herrera <alvherre(at)2ndquadrant(dot)com> |
---|---|
To: | Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com> |
Cc: | tgl(at)sss(dot)pgh(dot)pa(dot)us, ranier_gyn(at)hotmail(dot)com, pgsql-bugs(at)lists(dot)postgresql(dot)org |
Subject: | Re: [BUG FIX] Uninitialized var fargtypes used. |
Date: | 2019-11-12 14:01:29 |
Message-ID: | 20191112140129.GA7283@alvherre.pgsql |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
On 2019-Nov-12, Kyotaro Horiguchi wrote:
> At Mon, 11 Nov 2019 12:32:38 -0500, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> 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
Attachment | Content-Type | Size |
---|---|---|
nullary.patch | text/x-diff | 4.3 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Marcos David | 2019-11-12 15:57:57 | Re: BUG #16106: Patch - Radius secrets always gets lowercased |
Previous Message | Arseny Sher | 2019-11-12 11:35:10 | Re: ERROR: subtransaction logged without previous top-level txn record |