Function right

Source
pub fn right(s: &str, n: i32, writer: &mut impl Write)
Expand description

Returns the last n characters in the string. If n is a negative value, the function will return all but first |n| characters.

ยงExample

query T
select right('RisingWave', 4)
----
Wave

query T
select left('RisingWave', 42)
----
RisingWave

query T
select right('RisingWave', 0)
----
(empty)

query T
select right('RisingWave', -6)
----
Wave

# PostgreSQL returns the whole string due to an overflow bug, which we do not follow.
query T
select right('RisingWave', -2147483648);
----
(empty)