Search Postgresql Archives

Re: How to overload POSITION

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Troels Arvin <troels@xxxxxxxx> 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

---------------------------(end of broadcast)---------------------------
TIP 7: don't forget to increase your free space map settings

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Books]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]
  Powered by Linux