Re: Function overloading
От | Tom Lane |
---|---|
Тема | Re: Function overloading |
Дата | |
Msg-id | 17499.976421730@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Function overloading (Rynell Wesson <rwesson@cs.utexas.edu>) |
Ответы |
Re: Function overloading
|
Список | pgsql-novice |
Rynell Wesson <rwesson@cs.utexas.edu> writes: > I keep getting the following error. > psql:fdm:11: ERROR: Function 'foo(unknown, unknown)' does not exist That could only come out when you write select foo('string', 'string') and there is more than one possible candidate for foo(). The thing to realize here is that Postgres does not assume that 'string' is a string. Rather, it is a literal of as-yet-undetermined type. If the particular foo() function can be identified uniquely, then the system can infer what type the unknown-type literal should be converted to. Otherwise it gets unhappy. In the example you've given, select foo(text('testing'), text('testing')); ought to work fine to select the foo(text,text) function. It does work when I try it. I wonder whether you are looking for the problem in the wrong place. Is it possible that the error report is actually coming from trying to evaluate the function body? What did you put in the body, anyway? BTW, Postgres 7.1 has been tweaked to be more willing to assume that an unidentified-type literal is a string datatype, when it can't make a unique decision otherwise. So in 7.1 you'll get the result you expected from "select foo('string', 'string')". But the form with the explicit casts should have worked anyway. regards, tom lane
В списке pgsql-novice по дате отправления: