pg_startswith.sql 880 B

123456789101112131415161718192021222324252627282930313233343536
  1. /* syntax version 1 */
  2. /* postgres can not */
  3. /* dq can not */
  4. /* dqfile can not */
  5. /* yt can not */
  6. pragma warning("disable", "4510");
  7. pragma warning("disable", "1108");
  8. -- like 'aaaa'
  9. select YQL::RangeComputeFor(
  10. Struct<a:PgInt4,b:PgText>,
  11. ($row) -> (StartsWith(FromPg($row.b), 'aaaa') ?? false),
  12. AsTuple(AsAtom("b"))
  13. );
  14. -- not like 'aaaa'
  15. select YQL::RangeComputeFor(
  16. Struct<a:PgInt4,b:PgText>,
  17. ($row) -> (not (StartsWith(FromPg($row.b), 'aaaa') ?? true)),
  18. AsTuple(AsAtom("b"))
  19. );
  20. -- like <invalid utf8>
  21. select YQL::RangeComputeFor(
  22. Struct<a:PgInt4,b:PgText>,
  23. ($row) -> (StartsWith(FromPg($row.b), 'a\xf5') ?? false),
  24. AsTuple(AsAtom("b"))
  25. );
  26. -- not like <invalid utf8>
  27. select YQL::RangeComputeFor(
  28. Struct<a:PgInt4,b:PgText>,
  29. ($row) -> (not (StartsWith(FromPg($row.b), 'a\xf5') ?? true)),
  30. AsTuple(AsAtom("b"))
  31. );