Re: Functions just dont want to work! [hard]
От | Joel Burton |
---|---|
Тема | Re: Functions just dont want to work! [hard] |
Дата | |
Msg-id | 20021204195343.GA18499@temp.joelburton.com обсуждение исходный текст |
Ответ на | Functions just dont want to work! [hard] ("Yonatan Ben-Nes" <da@canaan.co.il>) |
Ответы |
Re: Functions just dont want to work! [hard]
|
Список | pgsql-general |
On Wed, Dec 04, 2002 at 08:32:34PM +0200, Yonatan Ben-Nes wrote: > Hi, > > I'm having a problem at a code which worked already and now after installing the new postgresql version it doesn't work(i didnt check it actually for about 2-3 months but i didnt change anything in the meanwhile). > > the problem occur only with functions which i created and the error which it gives me is (all of the functions get thesame error) - > Warning: PostgreSQL query failed: ERROR: Function insert_new_field(integer, "unknown", "unknown") does not exist Unableto identify a function that satisfies the given argument types You may need to add explicit typecasts. > > now i echoed the sql line itself and its - > SELECT insert_new_field(24, '2', '2'); > > while the function code itself is - > > CREATE FUNCTION public.insert_new_field(int2, text, text) RETURNS text AS ' Problem is that 24 is not an int2 -- it's an int4 (generic int type). For example: joel@joel=# create function hi(int2) returns bool as 'begin return true; end;' language 'plpgsql'; CREATE FUNCTION joel@joel=# select hi(42); ERROR: Function hi(integer) does not exist Unable to identify a function that satisfies the given argument types You may need to add explicit typecasts select hi(42::int2); works just fine. Either add a function that takes int4,tedt,text input, or explicitly cast your int4 to int2, as show above. -- Joel BURTON | joel@joelburton.com | joelburton.com | aim: wjoelburton Independent Knowledge Management Consultant
В списке pgsql-general по дате отправления: