Troels Arvin <troels@arvin.dk> writes:
> I assume this is because the POSITION function uses "IN" to separate
> arguments, in stead of a comma. Is there a way to overload it?
Double-quote "position" in the create function command --- it's a
keyword.
Be aware also of the argument order gotcha. Per gram.y:
| POSITION '(' position_list ')'
{
/* position(A in B) is converted to position(B, A) */
FuncCall *n = makeNode(FuncCall);
n->funcname = SystemFuncName("position");
n->args = $3;
n->agg_star = FALSE;
n->agg_distinct = FALSE;
$$ = (Node *)n;
}
Come to think of it, you'll also need to create your function in the
pg_catalog schema, because that's implied by SystemFuncName(). Which
means it won't get dumped by pg_dump. How wedded are you to being able
to say "IN"?
regards, tom lane