Thread: bug in function arguments "recognition"

bug in function arguments "recognition"

From
Ivan Sergio Borgonovo
Date:
I've a function defined as:

create or replace function catalog_relateditems(__itemid bigint,
  families int[]...

I call it with

select * from catalog_relateditems(6538::bigint, ARRAY[1,2,3,4,5]);
and I get:

HINT:  No function matches the given name and argument types. You
might need to add explicit type casts.

The I try to drop the function using psql autocomplete and I get...

DROP FUNCTION catalog_relateditems ( bigint, integer[], character
varying)

\df *rela*
reports:

public     | catalog_relateditems   | setof record     | __itemid
bigint, families integer[], OUT ...

There is no other function named catalog_relateditems

I'm on 8.3.9 debian lenny

--
Ivan Sergio Borgonovo
http://www.webthatworks.it


Re: bug in function arguments "recognition"

From
Tom Lane
Date:
Ivan Sergio Borgonovo <mail@webthatworks.it> writes:
> I've a function defined as:
> create or replace function catalog_relateditems(__itemid bigint,
>   families int[]...

If you want any useful comments, you're going to have to show a complete
example, rather than selectively editing out what you think is
irrelevant (and, no doubt, isn't).

            regards, tom lane

Re: bug in function arguments "recognition"

From
Ivan Sergio Borgonovo
Date:
On Wed, 3 Mar 2010 16:05:29 +0100
Ivan Sergio Borgonovo <mail@webthatworks.it> wrote:

> I've a function defined as:
>
> create or replace function catalog_relateditems(__itemid bigint,
>   families int[]...

Forget about it... there was a typo (missed out) that mixed in/out
parameters.

Sorry for the noise.

--
Ivan Sergio Borgonovo
http://www.webthatworks.it


Re: bug in function arguments "recognition"

From
Ivan Sergio Borgonovo
Date:
On Wed, 03 Mar 2010 10:22:31 -0500
Tom Lane <tgl@sss.pgh.pa.us> wrote:

> Ivan Sergio Borgonovo <mail@webthatworks.it> writes:
> > I've a function defined as:
> > create or replace function catalog_relateditems(__itemid bigint,
> >   families int[]...
>
> If you want any useful comments, you're going to have to show a
> complete example, rather than selectively editing out what you
> think is irrelevant (and, no doubt, isn't).

Golden rule... I thought that psql auto completion was a good enough
proof something wasn't working and I was thinking if someone could
give me a good advice to trim down the clutter to build up a simpler
function that could misbehave.

I was not aware that in and out parameters could be intermixed and I
was expecting an error, but pg was pretty happy with the syntax and
this was enough to put me astray.

Sorry

--
Ivan Sergio Borgonovo
http://www.webthatworks.it