问题
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)
回答1:
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.
来源:https://stackoverflow.com/questions/34431315/postgresql-9-3-function-is-not-unique-error