builtins: add trunc(decimal, int) builtin
fixes https://github.com/cockroachdb/cockroach/issues/85620
Release note (sql change): Added the trunc(decimal, int) builtin function, which truncates the given decimal value to the specified number of decimal places. A negative value can be used for the scale parameter, which will truncate to the left of the decimal point.
Example:
> select trunc(541.234, 2), trunc(541.234, 0), trunc(541.234, -1);
trunc | trunc | trunc
---------+-------+---------
541.23 | 541 | 5.4E+2
The latest CI is still failing with
client_merge_test.go:4753: ranges unexpectedly unmerged expected startKey /Table/106/1/1, but got /Table/106/1/2
Could this be related to the oid changes?
Where did you see those failures? I just see a data race for TestAdminAuditLogBasic which is caused by https://github.com/cockroachdb/cockroach/issues/85988 & https://github.com/cockroachdb/cockroach/issues/83080
I saw it from here, in TestMergeQueueWithSlowNonVoterSnaps. But I just test this commit locally and it passed, so I'm guessing it was just a flake...
Other than the CI failures everything LGTM!
tftr!
bors r=ZhouXing19
bors r=ZhouXing19