PostgreSQL 9.3: Function is not unique error

 ̄綄美尐妖づ 提交于 2019-12-13 13:13:34

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!