dbTalk Databases Forums  

[BUGS] 1.0 in function call not regarded as REAL in 7.3.2

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] 1.0 in function call not regarded as REAL in 7.3.2 in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Boris Folgmann
 
Posts: n/a

Default [BUGS] 1.0 in function call not regarded as REAL in 7.3.2 - 08-21-2003 , 09:05 AM






Hi!

I've triggered a type related problem in postgresql-7.3.2-3
It worked in postgresql-7.2.3-5.80.

CREATE OR REPLACE FUNCTION _rmin(REAL, REAL)
RETURNS REAL AS '
BEGIN
IF $1 <= $2 THEN
RETURN $1;
ELSE
RETURN $2;
END IF;
END;
' LANGUAGE 'plpgsql' WITH (ISCACHABLE);

This works:

SELECT _rmin(1.0, CAST(123 AS REAL));
_rmin
-------
1
(1 Zeile)

This not:

SELECT _rmin(1.0, CAST(123 AS REAL)/25);
ERROR: Funktion _rmin(numeric, double precision) existiert nicht
Unable to identify a function that satisfies the given argument types
You may need to add explicit typecasts

Look closely: postmaster now thinks that the first argument 1.0 is NUMERIC,
but I added only the /25 for the _second_ argument!

cu,
boris

--
Dipl.-Inf. Boris Folgmann mailto:boris (AT) folgmann (DOT) de
TeamForge GmbH http://www.teamforge.de


---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] 1.0 in function call not regarded as REAL in 7.3.2 - 08-21-2003 , 09:49 AM






Boris Folgmann <misc (AT) folgmann (DOT) com> writes:
Quote:
Look closely: postmaster now thinks that the first argument 1.0 is NUMERIC,
Yup. This is not a bug, it's intentional (and per SQL spec, AFAICT).

Your problem is that 123::real/25 yields a double precision result,
which is not implicitly castable to real anymore. I'd suggest
switching the function arguments to double precision.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 3: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.