@@ -452,3 +452,64 @@ select foo from (select 'xyzzy',1,null) as foo;
452452 (xyzzy,1,)
453453(1 row)
454454
455+ --
456+ -- Test VALUES lists
457+ --
458+ select * from onek, (values(147, 'RFAAAA'), (931, 'VJAAAA')) as v (i, j)
459+ WHERE onek.unique1 = v.i and onek.stringu1 = v.j;
460+ unique1 | unique2 | two | four | ten | twenty | hundred | thousand | twothousand | fivethous | tenthous | odd | even | stringu1 | stringu2 | string4 | i | j
461+ ---------+---------+-----+------+-----+--------+---------+----------+-------------+-----------+----------+-----+------+----------+----------+---------+-----+--------
462+ 147 | 0 | 1 | 3 | 7 | 7 | 7 | 47 | 147 | 147 | 147 | 14 | 15 | RFAAAA | AAAAAA | AAAAxx | 147 | RFAAAA
463+ 931 | 1 | 1 | 3 | 1 | 11 | 1 | 31 | 131 | 431 | 931 | 2 | 3 | VJAAAA | BAAAAA | HHHHxx | 931 | VJAAAA
464+ (2 rows)
465+
466+ -- a more complex case
467+ -- looks like we're coding lisp :-)
468+ select * from onek,
469+ (values ((select i from
470+ (values(10000), (2), (389), (1000), (2000), ((select 10029))) as foo(i)
471+ order by i asc limit 1))) bar (i)
472+ where onek.unique1 = bar.i;
473+ unique1 | unique2 | two | four | ten | twenty | hundred | thousand | twothousand | fivethous | tenthous | odd | even | stringu1 | stringu2 | string4 | i
474+ ---------+---------+-----+------+-----+--------+---------+----------+-------------+-----------+----------+-----+------+----------+----------+---------+---
475+ 2 | 326 | 0 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 2 | 4 | 5 | CAAAAA | OMAAAA | OOOOxx | 2
476+ (1 row)
477+
478+ -- try VALUES in a subquery
479+ select * from onek
480+ where (unique1,ten) in (values (1,1), (20,0), (99,9), (17,99))
481+ order by unique1;
482+ unique1 | unique2 | two | four | ten | twenty | hundred | thousand | twothousand | fivethous | tenthous | odd | even | stringu1 | stringu2 | string4
483+ ---------+---------+-----+------+-----+--------+---------+----------+-------------+-----------+----------+-----+------+----------+----------+---------
484+ 1 | 214 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 1 | 2 | 3 | BAAAAA | GIAAAA | OOOOxx
485+ 20 | 306 | 0 | 0 | 0 | 0 | 0 | 20 | 20 | 20 | 20 | 0 | 1 | UAAAAA | ULAAAA | OOOOxx
486+ 99 | 101 | 1 | 3 | 9 | 19 | 9 | 99 | 99 | 99 | 99 | 18 | 19 | VDAAAA | XDAAAA | HHHHxx
487+ (3 rows)
488+
489+ -- VALUES is also legal as a standalone query or a set-operation member
490+ VALUES (1,2), (3,4+4), (7,77.7);
491+ column1 | column2
492+ ---------+---------
493+ 1 | 2
494+ 3 | 8
495+ 7 | 77.7
496+ (3 rows)
497+
498+ VALUES (1,2), (3,4+4), (7,77.7)
499+ UNION ALL
500+ SELECT 2+2, 57
501+ UNION ALL
502+ SELECT * FROM int8_tbl;
503+ column1 | column2
504+ ------------------+-------------------
505+ 1 | 2
506+ 3 | 8
507+ 7 | 77.7
508+ 4 | 57
509+ 123 | 456
510+ 123 | 4567890123456789
511+ 4567890123456789 | 123
512+ 4567890123456789 | 4567890123456789
513+ 4567890123456789 | -4567890123456789
514+ (9 rows)
515+