1. Functions

a) Mathematical

A mathematical function operates on input values provided as arguments and returns a numeric value as the operation’s output.

MathematicalDescriptionExampleAvailable in Oxla
ABSReturns the absolute value of a number.SELECT ABS(-11);Available
CEILReturns the value after rounding up any positive or negative value to the nearest largest integer.SELECT CEIL(53.7);Available
FLOORReturns the value after rounding up any positive or negative decimal value as smaller than the argument.SELECT FLOOR(53.6);Available
LNReturns the natural logarithm of a given number.SELECT LN(3);Available
RANDOMReturns the random value between 0 and 1.SELECT RANDOM();Available
SQRTReturns the square root of a given positive number.SELECT SQRT(225);Available

b) Trigonometric

TrigonometricDescriptionExampleAvailable in Oxla
SINReturns the sine of the specified radian.SELECT sin(0.2);Available

2. Operators

a) Mathematical Operators

Below is a list of mathematical operators available in PostgreSQL:

OperatorsDescriptionExampleResultAvailable in Oxla
+AdditionSELECT 5 + 8;13Available
-SubtractionSELECT 2 - 3;\-1Available
-NegationSELECT -4;\-4Available
SELECT -(-4);4Available
SELECT 5+(-2);3Available
SELECT 5-(-2);7Available
*MultiplicationSELECT 3 * 3;9Available
/DivisionSELECT 10 / 2;5Available
%ModuloSELECT 20 % 3;2Available
&Bitwise ANDSELECT 91 & 15;11Available
#Bitwise XORSELECT 17 # 5;20Available

b) JSON Operators

Oxla supports operators for handling JSON data. One such operator is:

Equal Operator (=)

This operator checks if two JSON values are identical. In Oxla, this operator is order-sensitive which means that for two JSON objects to be considered equal, their key-value pairs must appear in the exact same order.

SELECT '{"a":1, "b":"c"}'::json = '{"b":"c", "a":1}'::json;

Result:

 ?column? 
----------
 f
(1 row)
In PostgreSQL, this operator is not order-sensitive, so the order of key-value pairs does not affect the comparison result.

3. Behaviors Difference

a) Output Header

Missing function name in output header, PostgreSQL shows the function name, like in this example:

SELECT COS(0),LN(1);
cos  | ln 
-----+-----
 1   | 0

Oxla does not show the function name, like in this example:

SELECT COS(0),LN(1);
 f | f_1 
---+-----
 1 | 0

b) ABS Output

Differences are also found in the ABS function, where there are differences in decimal results.

For example:

The example below will return the absolute value of -1.0

SELECT ABS(-1.0);

It returns 1 in Oxla, while in PostgreSQL, it produces 1.0

4. Errors Difference

FunctionsInputOutput - OxlaOutput - PostgreSQL
LNLN(0)InfinityERROR: cannot take the logarithm of zero
LN(0.0)InfinityERROR: cannot take the logarithm of zero
SQRTSQRT(-1)NaNERROR: cannot take the square root of a negative number
RANDOMSELECT floor(random()*(10-1+1))+1;ERROR: syntax error, unexpected INTVALworking as expected
SINSELECT sin(pi()/2);unknown function piworking as expected
/1/0error division(s) by zeroerror division(s) by zero
1/0.0Infinityerror division(s) by zero
0/0.0NaNerror division(s) by zero