Re: PostgreSQL 9.0.3 cannot choose the best candidate function with type casts - Mailing list pgsql-novice

From Tom Lane
Subject Re: PostgreSQL 9.0.3 cannot choose the best candidate function with type casts
Date
Msg-id 29912.1301929998@sss.pgh.pa.us
Whole thread Raw
In response to PostgreSQL 9.0.3 cannot choose the best candidate function with type casts  (<slapo@centrum.sk>)
Responses Re: PostgreSQL 9.0.3 cannot choose the best candidate function with type casts
List pgsql-novice
<slapo@centrum.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

pgsql-novice by date:

Previous
From: aaronenabs
Date:
Subject: pg_dump
Next
From: "messi.cro"
Date:
Subject: Oracle 2 PgSql, book