39 lines
583 B
SQL
39 lines
583 B
SQL
# name: test/sql/function/string/test_length.test
|
|
# description: Test length function
|
|
# group: [string]
|
|
|
|
statement ok
|
|
SET default_null_order='nulls_first';
|
|
|
|
statement ok
|
|
PRAGMA enable_verification
|
|
|
|
statement ok
|
|
CREATE TABLE strings(s VARCHAR)
|
|
|
|
statement ok
|
|
INSERT INTO strings VALUES ('hello'), ('world'), (NULL)
|
|
|
|
# normal length
|
|
query I
|
|
SELECT length(s) FROM strings ORDER BY s
|
|
----
|
|
NULL
|
|
5
|
|
5
|
|
|
|
# length after concat
|
|
query I
|
|
SELECT length(s || ' ' || '🦆') FROM strings ORDER BY s
|
|
----
|
|
NULL
|
|
7
|
|
7
|
|
|
|
# aliases work
|
|
query II
|
|
SELECT char_length('asdf'), CHARACTER_LENGTH('asdf')
|
|
----
|
|
4
|
|
4
|