From 0aa8f764088ea0f36620ae2955fa6c54ec736c46 Mon Sep 17 00:00:00 2001 From: Peter Eisentraut Date: Wed, 9 Sep 2020 20:16:28 +0200 Subject: Expose internal function for converting int64 to numeric Existing callers had to take complicated detours via DirectFunctionCall1(). This simplifies a lot of code. Reviewed-by: Tom Lane Discussion: https://www.postgresql.org/message-id/flat/42b73d2d-da12-ba9f-570a-420e0cce19d9@phystech.edu --- contrib/jsonb_plperl/jsonb_plperl.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'contrib/jsonb_plperl/jsonb_plperl.c') diff --git a/contrib/jsonb_plperl/jsonb_plperl.c b/contrib/jsonb_plperl/jsonb_plperl.c index b81ba54b80..22e90afe1b 100644 --- a/contrib/jsonb_plperl/jsonb_plperl.c +++ b/contrib/jsonb_plperl/jsonb_plperl.c @@ -216,9 +216,7 @@ SV_to_JsonbValue(SV *in, JsonbParseState **jsonb_state, bool is_elem) IV ival = SvIV(in); out.type = jbvNumeric; - out.val.numeric = - DatumGetNumeric(DirectFunctionCall1(int8_numeric, - Int64GetDatum((int64) ival))); + out.val.numeric = int64_to_numeric(ival); } else if (SvNOK(in)) { -- cgit v1.2.1