Received: from bologna.nettuno.it (bologna.nettuno.it [193.43.2.1]) by hub.org (8.9.1/8.9.1) with ESMTP id JAA01756 for ; Tue, 29 Dec 1998 09:43:52 -0500 (EST) (envelope-from jose@sferacarta.com) Received: from proxy.sferacarta.com (mail@sfcabop1.nettuno.it [193.207.10.213]) by bologna.nettuno.it (8.8.6/8.8.6/NETTuno 3.1) with ESMTP id PAA07855; Tue, 29 Dec 1998 15:43:20 +0100 (MET) Received: from rosso.sferacarta.com (sferacarta.com) [10.20.30.5] by proxy.sferacarta.com with esmtp (Exim 2.05 #1 (Debian)) id 0zv1Vv-0005ka-00; Tue, 29 Dec 1998 15:56:55 +0000 Message-ID: <3688E133.CB661A68@sferacarta.com> Date: Tue, 29 Dec 1998 15:03:31 +0100 From: "Jose' Soares" Reply-To: sferac@bo.nettuno.it Organization: Sfera Carta Software X-Mailer: Mozilla 4.05 [en] (Win95; I) MIME-Version: 1.0 To: Gordon Clarke CC: pgsql-sql@postgresql.org Subject: Re: [SQL] Probs with int2 in functions References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Gordon Clarke wrote: > > I'm using PostgreSQL v6.3.2. > > It appears that the function command doesn't like the type "int2" as a > parm in a call. For example, > > zedadmin=> \i zz.sql > create table test2( > trk_id int2 not null, > trk_nm varchar(30) not null, > trk_comp varchar(30)); > CREATE > > create function insert_test2(int2,varchar,varchar) > returns int4 as > 'insert into test2 > values($1,$2,$3); > select 1 as return_val;' > language 'sql'; > CREATE > EOF > > The objects are successfully created, but when I come to insert data via > the function there is the following error. > > zedadmin=> select insert_test2(1,'My name','My comment'); > ERROR: function insert_test2(int4, unknown, unknown) does not exist > > If one changes the int2 to an int4 in the table and function, the function > is happy to insert the data into the table. > > Any ideas why this is so, or is it a bug? > It works on my v6.4: select insert_test2(1,'My name','My comment'); insert_test2 ------------ 1 (1 row) select * from test2; trk_id|trk_nm |trk_comp ------+-------+---------- 1|My name|My comment 1|My name|My comment (2 rows) Any way try to cast values as: select insert_test2(1::int2,'My name'::varchar,'My comment'::varchar); -Jose'-