HomeMogDBMogDB StackUqbar
v5.0

Documentation:v5.0

Supported Versions:

Other Versions:

Mod Function Compatibility

Availability

This feature is available since MogDB 5.0.6.

Introduction

This feature is compatible with the behavior of the mod function. For mod(float, int), a call that mixes float and integer types, the return type is numeric, not integer.

Benefits

Enhance MogDB compatibility with Oracle to reduce application migration costs.

Description

In the old version of MogDB, the mod(float, int) function would convert the first parameter to int type, and then use mod(int, int) to calculate the result, resulting in the final result being inconsistent with the expectation. To address this situation, MogDB 5.0.6 converts both arguments to numeric type and calculates the result using mod(numeric, numeric) to ensure the correctness of the result.

Example

select mod(31::int8,16.02::float4);
  mod  
-------
 14.98
(1 row)

select mod(31.415::float4,16::int4);
  mod   
--------
 15.415
(1 row)

Mathematical Functions and Operators

Copyright © 2011-2024 www.enmotech.com All rights reserved.