[MDEV-20013] Should be able to use FIRST_VALUE as non-window function, like LAST_VALUE Created: 2019-07-10  Updated: 2019-07-10

Status: Open
Project: MariaDB Server
Component/s: None
Fix Version/s: None

Type: Task Priority: Minor
Reporter: Dean Trower Assignee: Unassigned
Resolution: Unresolved Votes: 0
Labels: None


 Description   

It would be nice if FIRST_VALUE() was also usable in non-window form as

FIRST_VALUE(expr,[expr,...])

where it would evaluate all arguments in order, and return the first one. This is both for the obvious symmetry with LAST_VALUE(), but also because sometimes it's more natural to write the expression you want to return first, e.g.

SELECT a, b, c, FIRST_VALUE(d, @var1:=e, @var2:= f) FROM table;

as opposed to:

SELECT a, b, c, LAST_VALUE(@var1:=e, @var2:= f, d) FROM table;

I realize this is basically cosmetic and doesn't actually add any functionality, but it would be nice to have nonetheless, and I imagine it'd be very simple to implement.


Generated at Thu Feb 08 08:56:04 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.