mirror of
https://github.com/postgres/postgres.git
synced 2025-12-12 02:37:31 +03:00
COALESCE() and NULLIF() are now first-class expressions, not macros
that turn into CASE expressions. They evaluate their arguments at most once. Patch by Kris Jurka, review and (very light) editorializing by me.
This commit is contained in:
@@ -154,32 +154,32 @@ SELECT * FROM CASE_TBL WHERE NULLIF(f,i) = 2;
|
||||
|
||||
SELECT COALESCE(a.f, b.i, b.j)
|
||||
FROM CASE_TBL a, CASE2_TBL b;
|
||||
case
|
||||
-------
|
||||
10.1
|
||||
10.1
|
||||
10.1
|
||||
10.1
|
||||
10.1
|
||||
10.1
|
||||
20.2
|
||||
20.2
|
||||
20.2
|
||||
20.2
|
||||
20.2
|
||||
20.2
|
||||
-30.3
|
||||
-30.3
|
||||
-30.3
|
||||
-30.3
|
||||
-30.3
|
||||
-30.3
|
||||
1
|
||||
2
|
||||
3
|
||||
2
|
||||
1
|
||||
-6
|
||||
coalesce
|
||||
----------
|
||||
10.1
|
||||
10.1
|
||||
10.1
|
||||
10.1
|
||||
10.1
|
||||
10.1
|
||||
20.2
|
||||
20.2
|
||||
20.2
|
||||
20.2
|
||||
20.2
|
||||
20.2
|
||||
-30.3
|
||||
-30.3
|
||||
-30.3
|
||||
-30.3
|
||||
-30.3
|
||||
-30.3
|
||||
1
|
||||
2
|
||||
3
|
||||
2
|
||||
1
|
||||
-6
|
||||
(24 rows)
|
||||
|
||||
SELECT *
|
||||
|
||||
Reference in New Issue
Block a user