summaryrefslogtreecommitdiff
path: root/src/function.c
diff options
context:
space:
mode:
authorMarko Kreen2012-11-16 13:28:45 +0000
committerMarko Kreen2012-11-16 13:28:45 +0000
commit8b260fb9e80aef0a38b20080a936a5f9780135e7 (patch)
tree778471608d256d82870e333e4c68fbf8afc6988f /src/function.c
parentbab6d43a7a71d8832a7879a01c68d82621503ac0 (diff)
Accept 't' proargmode, use symbolic names.
Also throw error on unknown proargmode. Fixes crash reported by Sébastien Lardière.
Diffstat (limited to 'src/function.c')
-rw-r--r--src/function.c32
1 files changed, 23 insertions, 9 deletions
diff --git a/src/function.c b/src/function.c
index 6107795..19b77ad 100644
--- a/src/function.c
+++ b/src/function.c
@@ -356,15 +356,29 @@ fn_get_arguments(ProxyFunction *func,
for (i = 0; i < total; i++)
{
- if (modes && modes[i] == 'o')
- continue;
- type = plproxy_find_type_info(func, types[i], 1);
- pos = func->arg_count++;
- func->arg_types[pos] = type;
- if (names && names[i])
- func->arg_names[pos] = plproxy_func_strdup(func, names[i]);
- else
- func->arg_names[pos] = NULL;
+ char mode = modes ? modes[i] : PROARGMODE_IN;
+ switch (mode) {
+ case PROARGMODE_IN:
+ case PROARGMODE_INOUT:
+ type = plproxy_find_type_info(func, types[i], 1);
+ pos = func->arg_count++;
+ func->arg_types[pos] = type;
+ if (names && names[i])
+ func->arg_names[pos] = plproxy_func_strdup(func, names[i]);
+ else
+ func->arg_names[pos] = NULL;
+ break;
+ case PROARGMODE_VARIADIC:
+ elog(ERROR, "PL/Proxy does not support variadic args");
+ break;
+ case PROARGMODE_OUT:
+ case PROARGMODE_TABLE:
+ /* output args, ignore */
+ break;
+ default:
+ elog(ERROR, "PL/Proxy: unknown value in proargmodes: %c", mode);
+ break;
+ }
}
}