RE: [SQL] Probs with int2 in functions

From: "Jackson, DeJuan" <djackson(at)cpsgroup(dot)com>
To: Gordon Clarke <gordonc(at)cyberbiz(dot)net(dot)au>, sferac(at)bo(dot)nettuno(dot)it
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: RE: [SQL] Probs with int2 in functions
Date: 1999-01-04 23:40:56
Message-ID: F10BB1FAF801D111829B0060971D839F5B06DA@cpsmail
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Well, it's not really a bug. It's the lack of a feature. Constant
integers are simply int4's not int2's and in pre-v6.4 the was no
auto-type coercion. The key here is 'auto'. If there was no type
coercion I'd have to agree that it was a bug. But simply because the
developers didn't assume that they know what I want better than I do,
doesn't make it a bug.
So, you have to specify type conversions yourself. If you want your
function to work as is upgrade.
-DEJ

> -----Original Message-----
> On Tue, 29 Dec 1998, Jose' Soares wrote:
>
> > > 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)
>
> So it appear that it is a bug in 6.3.2!
>
> > Any way try to cast values as:
> > select insert_test2(1::int2,'My name'::varchar,'My
> comment'::varchar);
>
> I'd prefer not to do that. Also, since it isn't necessary for the int4
> case then it shouldn't be for the int2 case and this suggests
> to me that
> it is a bug.
>
> Thanks for your suggestions and help.
>
> Cheers...Gordon

Browse pgsql-sql by date

  From Date Subject
Next Message Larry Bottorff 1999-01-05 14:45:04 Converting int4 to varchar
Previous Message Greg Youngblood 1999-01-04 18:33:18 Triggers and sql functions not working...