'Standard/common term for SQL functions/operators (never) throwing exceptions

There are many SQL functions/operators that are under certain circumstances throw exceptions.

Examples:

  • The division operator (/) throws a data exception if the divisor is zero.
  • The NTILE function throws an exception if the number of tiles is less than or equal to zero.
  • The CAST function throws an exception when the conversion leads to loss of precision.

There are also other SQL functions/operators that will never throw an exception.

SQL engines may have slightly different semantics about when (and if) an operator/function throws but what is of interest here is the terminology and not what happens for each database.

What is the right term to describe SQL operator/functions that:

  • may throw exceptions under certain circumstances
  • never throw exceptions no matter the input
sql


Solution 1:[1]

Reading the SQL standard I couldn't find a term describing such operators/functions so there may not be a standardized term to refer to them. I tried to see if there are DBMS specific terms that are widely used but couldn't find something either.

I know that in Apache Calcite community, some used the term unsafe [1, 2] to describe functions that may throw exceptions although I wouldn't recommend using it cause it is quite broad.

It seems that in mathematics they use the term undefined [3] to refer to expressions which do not have an actual representation (such as division by zero). Nevertheless, I would only use the term undefined to describe a specific evaluation of the function and not the function in general. Saying that division or CAST is undefined sounds weird and incorrect.

In C++, the term noexcept [4] is used to describe functions that never throw exceptions. So far this is the best term that I could find for describing functions that never throw and I think we can borrow it in the SQL community if there isn't a better one.

Lastly in the Java world, we have throwable [5] methods.This could be another term to use in the SQL world for describing those functions/operators that may throw.

References

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 zabetak