By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
Help with an interesting Postgres question: Why isn't an Index Only Scan used on a partition accessed via the parent table?.
CREATE OR REPLACE FUNCTION f_typetest(smallint) -- smallint!
RETURNS bool LANGUAGE sql AS 'SELECT true';
CREATE FUNCTION
-- Working calls
SELECT * FROM f_typetest('1');
SELECT * FROM f_typetest('1'::int2);
SELECT * FROM f_typetest(1::int2);
f_typetest |
---|
t |
SELECT 1
f_typetest |
---|
t |
SELECT 1
f_typetest |
---|
t |
SELECT 1
-- Does NOT work, because the unquoted numeric literal is cast as integer
SELECT * FROM f_typetest(1)
ERROR: function f_typetest(integer) does not exist LINE 2: SELECT * FROM f_typetest(1) ^ HINT: No function matches the given name and argument types. You might need to add explicit type casts.