pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
No function matches the given name and argument types.
7+ messages / 5 participants
[nested] [flat]

* No function matches the given name and argument types.
@ 2023-01-16 16:04  arons <arons7@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: arons @ 2023-01-16 16:04 UTC (permalink / raw)
  To: pgsql-general@lists.postgresql.org

Dear All,
I'm facing a general problem and I'm looking the best, fastest, way how to
identify the problem and solve it.

As example assume we have a function like that:

CREATE OR REPLACE FUNCTION testBinding01 (

p_in01 bigint,

p_in02 bigint,

p_in03 bigint,

p_in04 bigint,

p_in05 bigint,

p_in06 bigint,

p_text7 text

) RETURNS text

LANGUAGE sql

AS $$

select 'ciao';

$$;



I can call the function in some of the variant below:

select testBinding01(1,2,3,4,5,6,7);

select testBinding01(p_in01 => 1,p_in02 => 2,p_in03 => 3,p_in04 => 4,p_in05
=> 5,p_in06 => 6,p_text7 => 7);

select testBinding01(p_in01 => 1,p_in02 => 2,p_in03 => 3,p_in04 => 4,p_in05
=> 5,p_in06 => 6,p_text9 => 'some txt');

All of the above, produce the error:

*No function matches the given name and argument types.*



My question is: how is the best way  to identify the problem?

Is a parameter name? is a parameter type? is the function name?

An especially in case is a parameter type how is the easy way to identify
which parameter is causing the problem?

In case a function has a lot of parameters (and in even worst case has some
overloading) going trough all parameters to check its type/name costs a lot
of time.


Thanks for any help

Renzo

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: No function matches the given name and argument types.
@ 2023-01-16 16:17  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: arons <arons7@gmail.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Adrian Klaver @ 2023-01-16 16:17 UTC (permalink / raw)
  To: arons <arons7@gmail.com>; pgsql-general@lists.postgresql.org

On 1/16/23 08:04, arons wrote:
> Dear All,
> I'm facing a general problem and I'm looking the best, fastest, way how 
> to identify the problem and solve it.
> 
> As example assume we have a function like that:
> 
> CREATE OR REPLACE FUNCTION testBinding01 (
> 
> p_in01 bigint,
> 
> p_in02 bigint,
> 
> p_in03 bigint,
> 
> p_in04 bigint,
> 
> p_in05 bigint,
> 
> p_in06 bigint,
> 
> p_text7 text
> 
> ) RETURNS text
> 
> LANGUAGE sql
> 
> AS $$
> 
> select 'ciao';
> 
> $$;
> 
> 
> 
> I can call the function in some of the variant below:
> 
> select testBinding01(1,2,3,4,5,6,7);
> 
> select testBinding01(p_in01 => 1,p_in02 => 2,p_in03 => 3,p_in04 => 
> 4,p_in05 => 5,p_in06 => 6,p_text7 => 7);
> 
> select testBinding01(p_in01 => 1,p_in02 => 2,p_in03 => 3,p_in04 => 
> 4,p_in05 => 5,p_in06 => 6,p_text9 => 'some txt');
> 
> 
> All of the above, produce the error:
> 
> *No function matches the given name and argument types.*

In psql what does:

\df test*

return for the function name.

I'm going to guess it might be testBinding01, in other words mixed case.

Have you tried?:

select "testBinding01"(1,2,3,4,5,6,7);
> *
> *
> *
> *
> *
> *
> My question is: how is the best way  to identify the problem?
> 
> Is a parameter name? is a parameter type? is the function name?
> 
> An especially in case is a parameter type how is the easy way to 
> identify which parameter is causing the problem?
> 
> In case a function has a lot of parameters (and in even worst case has 
> some overloading) going trough all parameters to check its type/name 
> costs a lot of time.
> 
> 
> Thanks for any help
> 
> Renzo
> 
> 
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com






^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: No function matches the given name and argument types.
@ 2023-01-16 16:21  Adrian Klaver <adrian.klaver@aklaver.com>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 1 reply; 7+ messages in thread

From: Adrian Klaver @ 2023-01-16 16:21 UTC (permalink / raw)
  To: arons <arons7@gmail.com>; pgsql-general@lists.postgresql.org

On 1/16/23 08:17, Adrian Klaver wrote:
> On 1/16/23 08:04, arons wrote:
>> Dear All,
>> I'm facing a general problem and I'm looking the best, fastest, way 
>> how to identify the problem and solve it.
>>
>> As example assume we have a function like that:
>>
>> CREATE OR REPLACE FUNCTION testBinding01 (
>>
>> p_in01 bigint,
>>
>> p_in02 bigint,
>>
>> p_in03 bigint,
>>
>> p_in04 bigint,
>>
>> p_in05 bigint,
>>
>> p_in06 bigint,
>>
>> p_text7 text
>>
>> ) RETURNS text
>>
>> LANGUAGE sql
>>
>> AS $$
>>
>> select 'ciao';
>>
>> $$;
>>
>>
>>
>> I can call the function in some of the variant below:
>>
>> select testBinding01(1,2,3,4,5,6,7);
>>
>> select testBinding01(p_in01 => 1,p_in02 => 2,p_in03 => 3,p_in04 => 
>> 4,p_in05 => 5,p_in06 => 6,p_text7 => 7);
>>
>> select testBinding01(p_in01 => 1,p_in02 => 2,p_in03 => 3,p_in04 => 
>> 4,p_in05 => 5,p_in06 => 6,p_text9 => 'some txt');
>>
>>
>> All of the above, produce the error:
>>
>> *No function matches the given name and argument types.*
> 
> In psql what does:
> 
> \df test*
> 
> return for the function name.
> 
> I'm going to guess it might be testBinding01, in other words mixed case.
> 
> Have you tried?:
> 
> select "testBinding01"(1,2,3,4,5,6,7);

Forget the above. Instead:

select testBinding01(1,2,3,4,5,6,7);
ERROR:  function testbinding01(integer, integer, integer, integer, 
integer, integer, integer) does not exist
LINE 1: select testBinding01(1,2,3,4,5,6,7);


select testBinding01(1,2,3,4,5,6,'7');

testbinding01
---------------
  ciao

The complete error shows  what the function is receiving, all integers 
when it needs a text parameter for the last value.

>> *
>> *
>> *
>> *
>> *
>> *
>> My question is: how is the best way  to identify the problem?
>>
>> Is a parameter name? is a parameter type? is the function name?
>>
>> An especially in case is a parameter type how is the easy way to 
>> identify which parameter is causing the problem?
>>
>> In case a function has a lot of parameters (and in even worst case has 
>> some overloading) going trough all parameters to check its type/name 
>> costs a lot of time.
>>
>>
>> Thanks for any help
>>
>> Renzo
>>
>>
>>
> 

-- 
Adrian Klaver
adrian.klaver@aklaver.com






^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: No function matches the given name and argument types.
@ 2023-01-16 17:41  arons <arons7@gmail.com>
  parent: Adrian Klaver <adrian.klaver@aklaver.com>
  0 siblings, 2 replies; 7+ messages in thread

From: arons @ 2023-01-16 17:41 UTC (permalink / raw)
  To: Adrian Klaver <adrian.klaver@aklaver.com>; +Cc: pgsql-general@lists.postgresql.org

Why the error happen is clear to me, in the example is also easy to see
that the 7th parameter is the problem.
But I'm searching a more general way to find easily which of the parameter
is the problem.
Suppose you have a function with 30 parameters with mixed sort of types.
They only way I know right now is to compare the position, name and type
one parameter after the other until I found the one that do not match.
A sort of brute force.
Is there any better way to do that?

Thanks


On Mon, Jan 16, 2023 at 5:21 PM Adrian Klaver <adrian.klaver@aklaver.com>
wrote:

> On 1/16/23 08:17, Adrian Klaver wrote:
> > On 1/16/23 08:04, arons wrote:
> >> Dear All,
> >> I'm facing a general problem and I'm looking the best, fastest, way
> >> how to identify the problem and solve it.
> >>
> >> As example assume we have a function like that:
> >>
> >> CREATE OR REPLACE FUNCTION testBinding01 (
> >>
> >> p_in01 bigint,
> >>
> >> p_in02 bigint,
> >>
> >> p_in03 bigint,
> >>
> >> p_in04 bigint,
> >>
> >> p_in05 bigint,
> >>
> >> p_in06 bigint,
> >>
> >> p_text7 text
> >>
> >> ) RETURNS text
> >>
> >> LANGUAGE sql
> >>
> >> AS $$
> >>
> >> select 'ciao';
> >>
> >> $$;
> >>
> >>
> >>
> >> I can call the function in some of the variant below:
> >>
> >> select testBinding01(1,2,3,4,5,6,7);
> >>
> >> select testBinding01(p_in01 => 1,p_in02 => 2,p_in03 => 3,p_in04 =>
> >> 4,p_in05 => 5,p_in06 => 6,p_text7 => 7);
> >>
> >> select testBinding01(p_in01 => 1,p_in02 => 2,p_in03 => 3,p_in04 =>
> >> 4,p_in05 => 5,p_in06 => 6,p_text9 => 'some txt');
> >>
> >>
> >> All of the above, produce the error:
> >>
> >> *No function matches the given name and argument types.*
> >
> > In psql what does:
> >
> > \df test*
> >
> > return for the function name.
> >
> > I'm going to guess it might be testBinding01, in other words mixed case.
> >
> > Have you tried?:
> >
> > select "testBinding01"(1,2,3,4,5,6,7);
>
> Forget the above. Instead:
>
> select testBinding01(1,2,3,4,5,6,7);
> ERROR:  function testbinding01(integer, integer, integer, integer,
> integer, integer, integer) does not exist
> LINE 1: select testBinding01(1,2,3,4,5,6,7);
>
>
> select testBinding01(1,2,3,4,5,6,'7');
>
> testbinding01
> ---------------
>   ciao
>
> The complete error shows  what the function is receiving, all integers
> when it needs a text parameter for the last value.
>
> >> *
> >> *
> >> *
> >> *
> >> *
> >> *
> >> My question is: how is the best way  to identify the problem?
> >>
> >> Is a parameter name? is a parameter type? is the function name?
> >>
> >> An especially in case is a parameter type how is the easy way to
> >> identify which parameter is causing the problem?
> >>
> >> In case a function has a lot of parameters (and in even worst case has
> >> some overloading) going trough all parameters to check its type/name
> >> costs a lot of time.
> >>
> >>
> >> Thanks for any help
> >>
> >> Renzo
> >>
> >>
> >>
> >
>
> --
> Adrian Klaver
> adrian.klaver@aklaver.com
>
>

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: No function matches the given name and argument types.
@ 2023-01-16 17:49  Pavel Stehule <pavel.stehule@gmail.com>
  parent: arons <arons7@gmail.com>
  1 sibling, 0 replies; 7+ messages in thread

From: Pavel Stehule @ 2023-01-16 17:49 UTC (permalink / raw)
  To: arons <arons7@gmail.com>; +Cc: Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-general@lists.postgresql.org

Hi

po 16. 1. 2023 v 18:42 odesílatel arons <arons7@gmail.com> napsal:

> Why the error happen is clear to me, in the example is also easy to see
> that the 7th parameter is the problem.
> But I'm searching a more general way to find easily which of the parameter
> is the problem.
> Suppose you have a function with 30 parameters with mixed sort of types.
> They only way I know right now is to compare the position, name and type
> one parameter after the other until I found the one that do not match.
> A sort of brute force.
> Is there any better way to do that?
>

Unfortunately, it isn't or I don't know it

Regards

Pavel


>
> Thanks
>
>
> On Mon, Jan 16, 2023 at 5:21 PM Adrian Klaver <adrian.klaver@aklaver.com>
> wrote:
>
>> On 1/16/23 08:17, Adrian Klaver wrote:
>> > On 1/16/23 08:04, arons wrote:
>> >> Dear All,
>> >> I'm facing a general problem and I'm looking the best, fastest, way
>> >> how to identify the problem and solve it.
>> >>
>> >> As example assume we have a function like that:
>> >>
>> >> CREATE OR REPLACE FUNCTION testBinding01 (
>> >>
>> >> p_in01 bigint,
>> >>
>> >> p_in02 bigint,
>> >>
>> >> p_in03 bigint,
>> >>
>> >> p_in04 bigint,
>> >>
>> >> p_in05 bigint,
>> >>
>> >> p_in06 bigint,
>> >>
>> >> p_text7 text
>> >>
>> >> ) RETURNS text
>> >>
>> >> LANGUAGE sql
>> >>
>> >> AS $$
>> >>
>> >> select 'ciao';
>> >>
>> >> $$;
>> >>
>> >>
>> >>
>> >> I can call the function in some of the variant below:
>> >>
>> >> select testBinding01(1,2,3,4,5,6,7);
>> >>
>> >> select testBinding01(p_in01 => 1,p_in02 => 2,p_in03 => 3,p_in04 =>
>> >> 4,p_in05 => 5,p_in06 => 6,p_text7 => 7);
>> >>
>> >> select testBinding01(p_in01 => 1,p_in02 => 2,p_in03 => 3,p_in04 =>
>> >> 4,p_in05 => 5,p_in06 => 6,p_text9 => 'some txt');
>> >>
>> >>
>> >> All of the above, produce the error:
>> >>
>> >> *No function matches the given name and argument types.*
>> >
>> > In psql what does:
>> >
>> > \df test*
>> >
>> > return for the function name.
>> >
>> > I'm going to guess it might be testBinding01, in other words mixed case.
>> >
>> > Have you tried?:
>> >
>> > select "testBinding01"(1,2,3,4,5,6,7);
>>
>> Forget the above. Instead:
>>
>> select testBinding01(1,2,3,4,5,6,7);
>> ERROR:  function testbinding01(integer, integer, integer, integer,
>> integer, integer, integer) does not exist
>> LINE 1: select testBinding01(1,2,3,4,5,6,7);
>>
>>
>> select testBinding01(1,2,3,4,5,6,'7');
>>
>> testbinding01
>> ---------------
>>   ciao
>>
>> The complete error shows  what the function is receiving, all integers
>> when it needs a text parameter for the last value.
>>
>> >> *
>> >> *
>> >> *
>> >> *
>> >> *
>> >> *
>> >> My question is: how is the best way  to identify the problem?
>> >>
>> >> Is a parameter name? is a parameter type? is the function name?
>> >>
>> >> An especially in case is a parameter type how is the easy way to
>> >> identify which parameter is causing the problem?
>> >>
>> >> In case a function has a lot of parameters (and in even worst case has
>> >> some overloading) going trough all parameters to check its type/name
>> >> costs a lot of time.
>> >>
>> >>
>> >> Thanks for any help
>> >>
>> >> Renzo
>> >>
>> >>
>> >>
>> >
>>
>> --
>> Adrian Klaver
>> adrian.klaver@aklaver.com
>>
>>

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: No function matches the given name and argument types.
@ 2023-01-16 17:53  David G. Johnston <david.g.johnston@gmail.com>
  parent: arons <arons7@gmail.com>
  1 sibling, 1 reply; 7+ messages in thread

From: David G. Johnston @ 2023-01-16 17:53 UTC (permalink / raw)
  To: arons <arons7@gmail.com>; +Cc: Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-general@lists.postgresql.org

On Mon, Jan 16, 2023 at 10:42 AM arons <arons7@gmail.com> wrote:

> Why the error happen is clear to me, in the example is also easy to see
> that the 7th parameter is the problem.
> But I'm searching a more general way to find easily which of the parameter
> is the problem.
> Suppose you have a function with 30 parameters with mixed sort of types.
> They only way I know right now is to compare the position, name and type
> one parameter after the other until I found the one that do not match.
> A sort of brute force.
> Is there any better way to do that?
>
>>
>>
To what end?

In most cases you already know precisely which function you are trying to
execute.  Comparing that single function against your call site and
figuring out what is wrong is fairly simple debugging work.

I don't see any good way to say: "given this function signature, and the
fact it cannot be found, what are the next closest function signatures that
are present".

David J.

^ permalink  raw  reply  [nested|flat] 7+ messages in thread

* Re: No function matches the given name and argument types.
@ 2023-01-16 17:57  Christophe Pettus <xof@thebuild.com>
  parent: David G. Johnston <david.g.johnston@gmail.com>
  0 siblings, 0 replies; 7+ messages in thread

From: Christophe Pettus @ 2023-01-16 17:57 UTC (permalink / raw)
  To: David G. Johnston <david.g.johnston@gmail.com>; +Cc: arons <arons7@gmail.com>; Adrian Klaver <adrian.klaver@aklaver.com>; pgsql-general@lists.postgresql.org



> On Jan 16, 2023, at 09:53, David G. Johnston <david.g.johnston@gmail.com> wrote:
> 
> I don't see any good way to say: "given this function signature, and the fact it cannot be found, what are the next closest function signatures that are present".

I can see a use-case for such functionality, though: A "did you mean?" error message.




^ permalink  raw  reply  [nested|flat] 7+ messages in thread


end of thread, other threads:[~2023-01-16 17:57 UTC | newest]

Thread overview: 7+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2023-01-16 16:04 No function matches the given name and argument types. arons <arons7@gmail.com>
2023-01-16 16:17 ` Adrian Klaver <adrian.klaver@aklaver.com>
2023-01-16 16:21   ` Adrian Klaver <adrian.klaver@aklaver.com>
2023-01-16 17:41     ` arons <arons7@gmail.com>
2023-01-16 17:49       ` Pavel Stehule <pavel.stehule@gmail.com>
2023-01-16 17:53       ` David G. Johnston <david.g.johnston@gmail.com>
2023-01-16 17:57         ` Christophe Pettus <xof@thebuild.com>

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox