Function is_hex

The function checks a string variable for being a hexadecimal number being a bigint.

:heavy_exclamation_mark:This function needs to have hex2bigint being installed!:heavy_exclamation_mark:

If you use the package, both functions are installed in the correct sort order.

Examples

SELECT is_hex('a1b0') AS res;
-- Result is true

Result:

res
t
SELECT is_hex('a1b0w') AS res;
-- Result is false

Result:

res
f
SELECT is_hex('a1b0c3c3c3c4b5d3') AS res;
-- Result is false (does not fit into a bigint)

Result:

res
f