From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | slapo(at)centrum(dot)sk |
Cc: | pgsql-novice(at)postgresql(dot)org |
Subject: | Re: PostgreSQL 9.0.3 cannot choose the best candidate function with type casts |
Date: | 2011-04-04 15:13:18 |
Message-ID: | 29912.1301929998@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-novice |
<slapo(at)centrum(dot)sk> writes:
> I have a query in which I'm using a function called fx_get_parcel() like this:
> SELECT fx_get_parcel(cast('cash' AS varchar), cast(rs_i.d_depot AS varchar)) FROM...
> Without the type casts, Postgres complains that I have to add them.
Complains how exactly?
> When I add them, the query fails and I get this hint:
> HINT: Could not choose a best candidate function. You might need to add explicit type casts.
> The function has two versions:
> fx_get_parcel(character varying, character varying)
> and
> fx_get_parcel(character varying, character varying, integer)
I'll bet a good lunch that there are additional functions named
fx_get_parcel that you've forgotten are present. Either that,
or the three-argument form has a default value specified for the
integer parameter, which makes the call simply ambiguous.
I wouldn't expect the literal-constant argument to need explicit casting
in any case. If rs_i.d_depot is of a non-string datatype (integer for
instance), you probably would need an explicit cast here to make it into
a string. However, you wouldn't get the above error message from that.
regards, tom lane
From | Date | Subject | |
---|---|---|---|
Next Message | messi.cro | 2011-04-04 20:26:52 | Oracle 2 PgSql, book |
Previous Message | aaronenabs | 2011-04-04 14:32:28 | pg_dump |