diff options
author | udovichenko-r <udovichenko-r@yandex-team.com> | 2024-11-19 14:11:52 +0300 |
---|---|---|
committer | udovichenko-r <udovichenko-r@yandex-team.com> | 2024-11-19 14:22:01 +0300 |
commit | 72b3cd51dc3fb9d16975d353ea82fd85701393cc (patch) | |
tree | 318141940b8bf6bdb37ad6154e745e2ebfe3613f /yql/essentials/tests/postgresql/cases/select.sql | |
parent | 223625eed56ec3e2808c010eac46dba1c9a64d13 (diff) | |
download | ydb-72b3cd51dc3fb9d16975d353ea82fd85701393cc.tar.gz |
YQL-19206 Move contrib/ydb/library/yql/tests/postgresql -> yql/essentials/tests/postgresql
commit_hash:46fdf59714b20cf2b61233a06e58365227d3c8b2
Diffstat (limited to 'yql/essentials/tests/postgresql/cases/select.sql')
-rw-r--r-- | yql/essentials/tests/postgresql/cases/select.sql | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/yql/essentials/tests/postgresql/cases/select.sql b/yql/essentials/tests/postgresql/cases/select.sql new file mode 100644 index 0000000000..80e9c57baf --- /dev/null +++ b/yql/essentials/tests/postgresql/cases/select.sql @@ -0,0 +1,52 @@ +-- +-- SELECT +-- +-- btree index +-- awk '{if($1<10){print;}else{next;}}' onek.data | sort +0n -1 +-- +SELECT * FROM onek + WHERE onek.unique1 < 10 + ORDER BY onek.unique1; +-- +-- Test some cases involving whole-row Var referencing a subquery +-- +select foo from (select 1 offset 0) as foo; +select foo from (select null offset 0) as foo; +select foo from (select 'xyzzy',1,null offset 0) as foo; +-- VALUES is also legal as a standalone query or a set-operation member +VALUES (1,2), (3,4+4), (7,77.7); +VALUES (1,2), (3,4+4), (7,77.7) +UNION ALL +SELECT 2+2, 57 +UNION ALL +TABLE int8_tbl; +-- corner case: VALUES with no columns +CREATE TEMP TABLE nocols(); +-- +-- Test ORDER BY options +-- +CREATE TEMP TABLE foo (f1 int); +INSERT INTO foo VALUES (42),(3),(10),(7),(null),(null),(1); +SELECT * FROM foo ORDER BY f1 NULLS FIRST; +-- check if indexscans do the right things +CREATE INDEX fooi ON foo (f1); +SELECT * FROM foo ORDER BY f1 NULLS FIRST; +CREATE INDEX fooi ON foo (f1 DESC); +SELECT * FROM foo ORDER BY f1 NULLS FIRST; +CREATE INDEX fooi ON foo (f1 DESC NULLS LAST); +SELECT * FROM foo ORDER BY f1 NULLS FIRST; +select * from onek2 where unique2 = 11 and stringu1 = 'ATAAAA'; +select unique2 from onek2 where unique2 = 11 and stringu1 = 'ATAAAA'; +select * from onek2 where unique2 = 11 and stringu1 < 'B'; +select unique2 from onek2 where unique2 = 11 and stringu1 < 'B'; +select unique2 from onek2 where unique2 = 11 and stringu1 < 'B' for update; +select unique2 from onek2 where unique2 = 11 and stringu1 < 'C'; +select unique2 from onek2 where unique2 = 11 and stringu1 < 'B'; +select unique1, unique2 from onek2 + where (unique2 = 11 or unique1 = 0) and stringu1 < 'B'; +select unique1, unique2 from onek2 + where (unique2 = 11 and stringu1 < 'B') or unique1 = 0; +-- X = X isn't a no-op, it's effectively X IS NOT NULL assuming = is strict +-- (see bug #5084) +select * from (values (2),(null),(1)) v(k) where k = k order by k; +select * from (values (2),(null),(1)) v(k) where k = k; |