Re: How do you execute a postgresql function from perl? - Mailing list pgsql-hackers

From John Gray
Subject Re: How do you execute a postgresql function from perl?
Date
Msg-id b7ep2m$fh9$1@news.hub.org
Whole thread Raw
In response to Re: How do you execute a postgresql function from perl?  (Stu Krone <skrone@blueonyxgroup.com>)
List 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]



pgsql-hackers by date:

Previous
From: cbbrowne@cbbrowne.com
Date:
Subject: Re: No merge sort?
Next
From: Tom Lane
Date:
Subject: Re: [GENERAL] Problem about pgsql's column alias