aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/compute_range/pg_startswith.sql
blob: 0ed99c65c08f4fe90caf30dbdf6b0923937a3255 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* syntax version 1 */
/* postgres can not */
/* dq can not */
/* dqfile can not */
/* yt can not */
pragma warning("disable", "4510");
pragma warning("disable", "1108");

-- like 'aaaa'
select YQL::RangeComputeFor(
	    Struct<a:PgInt4,b:PgText>,
	    ($row) -> (StartsWith(FromPg($row.b), 'aaaa') ?? false),
	    AsTuple(AsAtom("b"))
);

-- not like 'aaaa'
select YQL::RangeComputeFor(
	    Struct<a:PgInt4,b:PgText>,
	    ($row) -> (not (StartsWith(FromPg($row.b), 'aaaa') ?? true)),
	    AsTuple(AsAtom("b"))
);


-- like <invalid utf8>
select YQL::RangeComputeFor(
	    Struct<a:PgInt4,b:PgText>,
	    ($row) -> (StartsWith(FromPg($row.b), 'a\xf5') ?? false),
	    AsTuple(AsAtom("b"))
);

-- not like <invalid utf8>
select YQL::RangeComputeFor(
	    Struct<a:PgInt4,b:PgText>,
	    ($row) -> (not (StartsWith(FromPg($row.b), 'a\xf5') ?? true)),
	    AsTuple(AsAtom("b"))
);