I have created the following function with 11 parameters as shown in below:
Function calling:
SELECT * FROM function_TableDetails
(
NULL::Type_Table,
'2671ffdb-28a4-4ce4-a226-e5a21d66509e',
'D09636DC-0185-4FFC-AEDD-63895B445CD8',
'Xyz',
'Cola',
'20028243-52c2-4d23-a6fe-c3694aab84a2',
'01-01-2000',
'01-01-2016',
'00:00:01',
'23:59:59',
'Al'
);
Butting the following error:
ERROR: function function_TableDetails(Type_Table, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown, unknown) is not unique
LINE 1: SELECT * FROM function_TableDetails
^
HINT: Could not choose a best candidate function. You might need to add explicit type casts.
I have two questions on this:
First: How to resolve the above error? (Because it is not even going within the function and not showing exact location of error)
Second: How to debugg the function? (Specially have to work on such type of errors)
if it is an user defined exception, delete the corresponding declaration and specify unique error code via ERRCODE in a USING clause. in catch-block replace SQLCODE by SQLSTATE.
DROP FUNCTION removes the definition of an existing function. To execute this command the user must be the owner of the function. The argument types to the function must be specified, since several different functions can exist with the same name and different argument lists.
You have two or more functions named function_TableDetails
and expecting 11 arguments, though the types of some arguments are different. Your string arguments are untyped, so Postgres can't figure out which function you want.
This query will show the signature of each of these functions:
SELECT oid::regprocedure
FROM pg_proc
WHERE proname = 'function_tabledetails'
If you created these inadvertently, just drop the ones you don't want. Otherwise, cast your arguments to match the types expected by the one you're trying to call.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With