Re: How do you execute a postgresql function from perl?

From: "John Gray" <jgray(at)azuli(dot)co(dot)uk>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: How do you execute a postgresql function from perl?
Date: 2003-04-14 16:52:34
Message-ID: b7ep2m$fh9$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Mon, 14 Apr 2003 16:01:54 +0000, Stu Krone wrote:

> Hi Nigel,
>
> Nope, no luck.
>
> This is the error I found:
>
> DBD::Pg::st execute failed: ERROR: Function 'insert_data(unknown, int4,
> int4, int4,)' does not exist at ./scope_db_func.pl line 100.
>
>
This means that a function with the correct signature wasn't found -
because Postgres allows function overloading, there can be multiple
insert_data functions as long as their argument types differ. In this
case, the problem is that device_num, inode_num and file_mode are declared
as character in the function prototype, but the parameters you are passing
to them are numeric. (The reference in the error message to
insert_data(unknown,int4,int4,int4) is revealing. Once those constants
have been treated as numeric, the signature
(character,character,character,character) won't match. )

Solutions:

1. If you change the function to
insert_data (text,integer,integer,integer) RETURNS boolean

it should work.

Or
2. Present the numbers for device_num, inode_num and file_mode
inside single quotes if you want them not to be treated as numerics.

I hope that helps.

Regards

John

[snipped]

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message cbbrowne 2003-04-14 16:52:57 Re: No merge sort?
Previous Message Peter Eisentraut 2003-04-14 16:40:01 Re: [GENERAL] Problem about pgsql's column alias