SQL: Add TRUNC alias for TRUNCATE#49571
Conversation
Add TRUNC as alias to already implemented TRUNCATE numeric function which is the flavour supported by Oracle and PostgreSQL. Relates to: elastic#41195
|
Pinging @elastic/es-search (:Search/SQL) |
|
|
||
| [[sql-functions-math-truncate]] | ||
| ==== `TRUNCATE` | ||
| ==== `TRUNCATE/TRUNC` |
There was a problem hiding this comment.
Shouldn't be TRUNC/TRUNCATE (alphabetical order)?
There was a problem hiding this comment.
In general, we don't do it alphabetically here, for example: DAY_OF_MONTH/DOM/DAY
@astefan, what do you think?
There was a problem hiding this comment.
Seems indeed a mixed usage: CEIL/CEILING, but also RANDOM/RAND.
Fwiw, I find the "short/long" version easier to read (i.e. visually take in), but unless we order them all like that, this one case is not very relevant.
There was a problem hiding this comment.
I was thinking also that TRUNCATE was already there, if we put TRUNC first we will need to also change the definition paragraph and use TRUNC instead (we always use the 1st version there).
There was a problem hiding this comment.
The initial implementation for RANDOM and TRUNCATE came from https://docs.microsoft.com/en-us/sql/odbc/reference/appendixes/numeric-functions?view=sql-server-2017, where they are indeed called like that. I agree with Marios here: in our docs the first name is the "main" one and the rest are aliases. For consistency, I would go with TRUNCATE/TRUNC, RANDOM/RAND etc. The biggest counter-example to the "alphabetical" approach is the series of DOM/DOY/DOW/DAYNAME aliases for some of the date/datetime functions.
Add TRUNC as alias to already implemented TRUNCATE
numeric function which is the flavour supported by
Oracle and PostgreSQL.
Relates to: #41195