Currently getting an error about type casts,
HINT: Could not choose a best candidate function. You might need to add explicit type casts.
Let's say I create an overloaded function foo
CREATE FUNCTION foo(x int)
RETURNS int AS $$
SELECT 1
$$ LANGUAGE sql;
CREATE FUNCTION foo(x interval)
RETURNS int AS $$
SELECT 2
$$ LANGUAGE sql;
How come when I then call that function,
SELECT foo('5 days');
I get,
ERROR: function foo(unknown) is not unique
LINE 1: SELECT foo('5 days');
^
HINT: Could not choose a best candidate function. You might need to add explicit type casts.
Question inspired by looking into generate_series and the conversations on irc.freenode.net/#postgresql
interval '5' day– Nov 10 '17 at 06:49generate_series– Evan Carroll Nov 10 '17 at 07:27INTERVAL '1' YEARand thtat is the same syntax that Oracle uses – Nov 10 '17 at 07:29interval '1-2' year to monthor simplyinterval '1-2'see: https://www.postgresql.org/docs/10/static/datatype-datetime.html#DATATYPE-INTERVAL-INPUT-EXAMPLES – Nov 10 '17 at 07:49