Files
stonks-oracle/infra/migrations/022_round_float_overload.sql

9 lines
356 B
PL/PgSQL

-- Add a round(double precision, integer) overload so ad-hoc queries
-- using round(some_float, 2) work without explicit ::numeric casts.
-- PostgreSQL only provides round(numeric, integer) out of the box.
CREATE OR REPLACE FUNCTION round(double precision, integer)
RETURNS numeric AS $$
SELECT round($1::numeric, $2);
$$ LANGUAGE sql IMMUTABLE STRICT;