BUG #2357: docs for mod() are wrong - Mailing list pgsql-bugs

From Philip Crotwell
Subject BUG #2357: docs for mod() are wrong
Date
Msg-id 200603241700.k2OH0iYM059116@wwwmaster.postgresql.org
Whole thread Raw
Responses Re: BUG #2357: docs for mod() are wrong
List pgsql-bugs
The following bug has been logged online:

Bug reference:      2357
Logged by:          Philip Crotwell
Email address:      crotwell@seis.sc.edu
PostgreSQL version: 8.1
Operating system:   linux
Description:        docs for mod() are wrong
Details:

The docs for mod() say that the return type is "(same as argument types)"
which would seem to indicate that you could call mod() with doubles.
However, mod() with double arguments gives this error:
ERROR:  function mod(double precision, integer) does not exist

For example:
   select mod(degrees(1), 1);
ERROR:  function mod(double precision, integer) does not exist
HINT:  No function matches the given name and argument types. You may need
to add explicit type casts.

It would be nice if mod could directly take a double, but if not the docs
should say that the arguments should be NUMERIC and you must cast, for
example this works:
   select mod(CAST (degrees(1) AS NUMERIC), 1);

pgsql-bugs by date:

Previous
From: "Philip Crotwell"
Date:
Subject: BUG #2356: sqrt and cbrt return different types
Next
From: Alvaro Herrera
Date:
Subject: Re: Error in ecpg