Can someone explain how this WHERE clause work in this query?
SELECT * FROM "User" AS U
WHERE ((U."ID", U."age") > (23820, 25));
As I understand Postgres returns users where the id is greater than 23820 and ignore the age column.
CodePudding user response:
@JonasMetzler is correct on the comment. Postgres apparently uses this set as something on the lines of:
Most left parameter uses the operator, all the others use equal
OR
repeat until one parameter left (
Remove most left parameter
Most left parameter uses the operator, all the others use equal
)
(parameter_n, [parameter_n-1, ..., parameter_n-final]) <operator> (value_n, [value_n-1, ..., value_n-final])
equals to
(parameter_n = value_n AND parameter_n-1 = value_n-1 AND ... parameter_n-final <operator> value_n-final)
OR
(parameter_n = value_n AND parameter_n-1 = value_n-1 AND ... parameter_n-final-1 <operator> value_n-final-1)
OR
...
(parameter_n = value_n AND parameter_n-1 <operator> value_n-1)
OR
(parameter_n <operator> value_n)