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

18 lines
822 B
SQL

select match('a key="v" ', 'key="(.*?)"');
select match(materialize('a key="v" '), 'key="(.*?)"');
select match('\0 key="v" ', 'key="(.*?)"');
select match(materialize('\0 key="v" '), 'key="(.*?)"');
select multiMatchAny('\0 key="v" ', ['key="(.*?)"']);
select multiMatchAny(materialize('\0 key="v" '), ['key="(.*?)"']);
select unhex('34') || ' key="v" ' as haystack, length(haystack), extract( haystack, 'key="(.*?)"') as needle;
-- works, result = v
select unhex('00') || ' key="v" ' as haystack, length(haystack), extract( haystack, 'key="(.*?)"') as needle;
-- before fix: returns nothing (zero-byte in the begining of haystack)
select number as char_code, extract( char(char_code) || ' key="v" ' as haystack, 'key="(.*?)"') as needle from numbers(256);
-- every other chars codes (except of zero byte) works ok