﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
36221	Greatest() argument count guards do not align with certain database backends	Martijn Verkleij		"I ran into two issues while I tried to use this comparison function `django.db.models.function.comparison.Greatest`:

* It forces you to use two or more arguments, while the Postgres database backend, for example, allows for one argument.
* If the argument supplied is a generator expression, it is not unpacked and the above check triggers while more arguments are supplied.

I found these while using Django 4.2, but I have checked the current source code and it is unchanged compared to that version.

For the first one, a possible solution might be to move the check to the different database backends, or be generalized somehow to allow certain backends to have different numbers of arguments. One could even consider writing custom SQL generators for lists of length one (returning the value bare), and an exception for passing the empty list.

The second one appears to be a Python language limitation for which it is debatable whether to bother implementing anything to fix it. Converting the expression to a tuple and unpacking it solves the problem."	New feature	closed	Database layer (models, ORM)	4.2	Normal	wontfix			Unreviewed	0	0	0	0	0	0
