Differences Between Oxla vs. PostgreSQL
1. Functions
a) Mathematical
A mathematical function operates on input values provided as arguments and returns a numeric value as the operation's output.
Mathematical | Description | Example | Available in Oxla |
ABS | Returns the absolute value of a number. | SELECT ABS(-11); | Available |
CEIL | Returns the value after rounding up any positive or negative value to the nearest largest integer. | SELECT CEIL(53.7); | Available |
FLOOR | Returns the value after rounding up any positive or negative decimal value as smaller than the argument. | SELECT FLOOR(53.6); | Available |
LN | Returns the natural logarithm of a given number. | SELECT LN(3); | Available |
RANDOM | Returns the random value between 0 and 1. | SELECT RANDOM(); | Available |
SQRT | Returns the square root of a given positive number. | SELECT SQRT(225); | Available |
b) Trigonometric
Trigonometric | Description | Example | Available in Oxla |
SIN | Returns the sine of the specified radian. | SELECT sin(0.2); | Available |
2. Operators
Below is a list of math operators available in PostgreSQL:
Operators | Description | Example | Result | Available in Oxla | Note |
+ | Addition |
| f
----
13 | Available | ο»Ώ |
- | Subtraction |
| f
----
-1 | Available | ο»Ώ |
- | Negation | SELECT -4; | f
----
-4 | Available | ο»Ώ |
ο»Ώ | ο»Ώ | SELECT -(-4); | f
----
4 | Available | ο»Ώ |
ο»Ώ | ο»Ώ | SELECT 5+(-2); | f
----
3 | Available | ο»Ώ |
ο»Ώ | ο»Ώ | SELECT 5-(-2); | f
----
7 | Available | ο»Ώ |
* | Multiplication |
| f
----
9 | Available | ο»Ώ |
/ | Division |
| f
----
5 | Available | ο»Ώ |
% | Modulo |
| f
----
2 | Available | ο»Ώ |
& | Bitwise AND | 91 & 15 | f
----
91 | Available | the result is different from PostgreSQL |
# | Bitwise XOR | 17 # 5 | f
----
17 | Available | the result is different from PostgreSQL |
3. Behaviors Difference
a) Output Header
Missing function name in output header, PostgreSQL shows the function name, like in this example:
Oxla does not show the function name, like in this example:
b) Whitespace
Different behavior of mathematical operators when white space is used.
For example: Oxla can calculate expressions '2 - 3' or β2- 3β, but β2 -3β or β2-3β reports syntax errors. For other operators work in all cases.
c) 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
It returns 1 in Oxla, while in PostgreSQL, it produces 1.0
4. Errors Difference
Functions | Input | Output - Oxla | Output - PostgreSQL |
LN | LN(0) | Infinity | ERROR: cannot take the logarithm of zero |
ο»Ώ | LN(0.0) | Infinity | ERROR: cannot take the logarithm of zero |
SQRT | SQRT(-1) | NaN | ERROR: cannot take the square root of a negative number |
RANDOM | SELECT floor(random()*(10-1+1))+1; | ERROR: syntax error, unexpected INTVAL | working as expected |
SIN | SELECT sin(pi()/2); | unknown function pi | working as expected |
/ | 1/0 | error division(s) by zero | error division(s) by zero |
ο»Ώ | 1/0.0 | Infinity | error division(s) by zero |
ο»Ώ | 0/0.0 | NaN | error division(s) by zero |
ο»Ώ