ClickHouse/tests/queries/0_stateless/00997_trim.sql
Ivan 97f2a2213e
Move all folders inside /dbms one level up ()
* Move some code outside dbms/src folder
* Fix paths
2020-04-02 02:51:21 +03:00

21 lines
740 B
SQL

WITH
'0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ' AS x,
replaceRegexpAll(x, '.', ' ') AS spaces,
concat(substring(spaces, 1, rand(1) % 62), substring(x, 1, rand(2) % 62), substring(spaces, 1, rand(3) % 62)) AS s,
trimLeft(s) AS sl,
trimRight(s) AS sr,
trimBoth(s) AS t,
replaceRegexpOne(s, '^ +', '') AS slr,
replaceRegexpOne(s, ' +$', '') AS srr,
replaceRegexpOne(s, '^ *(.*?) *$', '\\1') AS tr
SELECT
replaceAll(s, ' ', '_'),
replaceAll(sl, ' ', '_'),
replaceAll(slr, ' ', '_'),
replaceAll(sr, ' ', '_'),
replaceAll(srr, ' ', '_'),
replaceAll(t, ' ', '_'),
replaceAll(tr, ' ', '_')
FROM numbers(100000)
WHERE NOT ((sl = slr) AND (sr = srr) AND (t = tr))