Bug #864: MOD(RANDOM(),1.0) don't work in 7.3.1

Started by PostgreSQL Bugs Listover 23 years ago3 messagesbugs
Jump to latest
#1PostgreSQL Bugs List
pgsql-bugs@postgresql.org

Sverre H. Huseby (shh@thathost.com) reports a bug with a severity of 3
The lower the number the more severe it is.

Short Description
MOD(RANDOM(),1.0) don't work in 7.3.1

Long Description
I just upgraded from 7.2.3 to 7.3.1. Something has changed, as one of my old queries no longer works:

SELECT MOD(RANDOM(),1.0);
ERROR: Function mod(double precision, numeric) does not exist
Unable to identify a function that satisfies the given argument types
You may need to add explicit typecasts

I was able to work around it by casting RANDOM() to NUMERIC.

Sample Code

No file was uploaded with this report

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: PostgreSQL Bugs List (#1)
Re: Bug #864: MOD(RANDOM(),1.0) don't work in 7.3.1

pgsql-bugs@postgresql.org writes:

SELECT MOD(RANDOM(),1.0);
ERROR: Function mod(double precision, numeric) does not exist
Unable to identify a function that satisfies the given argument types
You may need to add explicit typecasts

I was able to work around it by casting RANDOM() to NUMERIC.

This is not a bug, but an intentional change: float->numeric isn't an
implicit cast anymore.

regards, tom lane

#3Sverre H. Huseby
shh@thathost.com
In reply to: Tom Lane (#2)
Re: Bug #864: MOD(RANDOM(),1.0) don't work in 7.3.1

[Tom Lane]

| This is not a bug, but an intentional change: float->numeric isn't
| an implicit cast anymore.

Ah. I didn't find it in the "Observe the following incompatibilities"
of the HISTORY file, so I imagined it could be unintentional.

Thanks for replying!

Sverre.

--
shh@thathost.com Computer Geek? Try my Nerd Quiz
http://shh.thathost.com/ http://nerdquiz.thathost.com/