Real values are stored in binary format, so you can only decide in what form they will be shown. You can cast real values to numeric using (precision, scale) like this:
with my_table(the_num) as (
values
(6.0::real),
(6.1),
(6.15)
)
select the_num, the_num::numeric(15,1), the_num::numeric(15,2)
from my_table
the_num | the_num | the_num
---------+---------+---------
6 | 6.0 | 6.00
6.1 | 6.1 | 6.10
6.15 | 6.2 | 6.15
(3 rows)
Alternatively, you can use the function to_char(), e.g.
select the_num, to_char(the_num, '999D9'), to_char(the_num, '999D99')
from my_table
the_num | to_char | to_char
---------+---------+---------
6 | 6.0 | 6.00
6.1 | 6.1 | 6.10
6.15 | 6.2 | 6.15
(3 rows)
You can also use the numeric type instead of real in the table definition, e.g.:
create table my_table (
the_num numeric(15, 2)
);
In this case the values will be stored with the defined scale.
Read more about Numeric Types in the documentation.