Round(DP Or numeric ) returns integer

Started by PG Bug reporting formabout 7 years ago2 messagesdocs
Jump to latest
#1PG Bug reporting form
noreply@postgresql.org

The following documentation comment has been logged on the website:

Page: https://www.postgresql.org/docs/11/functions-math.html
Description:

1) The function round( dp or numeric ) always has return type integer not
same as our parameter is.
2) The function round( dp or numeric, s int ) returns the same type as our
parameter is not an integer type.

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: PG Bug reporting form (#1)
Re: Round(DP Or numeric ) returns integer

PG Doc comments form <noreply@postgresql.org> writes:

1) The function round( dp or numeric ) always has return type integer not
same as our parameter is.
2) The function round( dp or numeric, s int ) returns the same type as our
parameter is not an integer type.

Huh?

postgres=# \df round
List of functions
Schema | Name | Result data type | Argument data types | Type
------------+-------+------------------+---------------------+------
pg_catalog | round | double precision | double precision | func
pg_catalog | round | numeric | numeric | func
pg_catalog | round | numeric | numeric, integer | func
(3 rows)

The description in the docs matches reality AFAICS.

regards, tom lane