-
Notifications
You must be signed in to change notification settings - Fork 8k
Open
Labels
unexpected behaviourResult is unexpected, but not entirely wrong at the same time.Result is unexpected, but not entirely wrong at the same time.
Description
This works:
:) select 'hello\nworld'
SELECT 'hello\nworld'
Query id: f8ab4b49-3cf0-4baa-b16e-948c77c24509
┌─'hello\nworld'─┐
1. │ hello
world │
└────────────────┘
1 row in set. Elapsed: 0.002 sec.
But this doesn't:
:) set param_a = 'hello\nworld'
SET param_a = 'hello\nworld'
Query id: 0bc67eea-0ef3-4359-8f4a-8fdda793f754
Ok.
0 rows in set. Elapsed: 0.001 sec.
:) select {a: String}
SELECT {a:String}
Query id: 27496ba6-0e00-4b89-a4af-b4b14b7ecd78
Elapsed: 0.002 sec.
Received exception from server (version 24.10.1):
Code: 457. DB::Exception: Received from localhost:9000. DB::Exception: Value hello
world cannot be parsed as String for query parameter 'a' because it isn't parsed completely: only 5 of 11 bytes was parsed: hello. (BAD_QUERY_PARAMETER)
Same for \t:
:) set param_a = 'hello\tworld'
SET param_a = 'hello\tworld'
Query id: cc8cc949-bd8d-4eda-9a3a-79a83af28023
Ok.
0 rows in set. Elapsed: 0.001 sec.
:) select {a: String}
SELECT {a:String}
Query id: f685c623-b1d7-4933-9478-4522da4be428
Elapsed: 0.002 sec.
Received exception from server (version 24.10.1):
Code: 457. DB::Exception: Received from localhost:9000. DB::Exception: Value hello world cannot be parsed as String for query parameter 'a' because it isn't parsed completely: only 5 of 11 bytes was parsed: hello. (BAD_QUERY_PARAMETER)
But \\ works:
:) set param_a = 'hello\\world'
SET param_a = 'hello\\world'
Query id: 8a963a2d-56aa-4bfe-b7b3-fd2854b14231
Ok.
0 rows in set. Elapsed: 0.001 sec.
:) select {a: String}
SELECT {a:String}
Query id: ffb740a9-7b3f-4c2a-9b0d-1b272250810d
┌─'hello\\world'─┐
1. │ hello\world │
└────────────────┘
1 row in set. Elapsed: 0.002 sec.
Is this a bug, or is there some logic behind it? I would expect any valid string literal to be usable as parameter value.
Mirraz and tokarchyn
Metadata
Metadata
Assignees
Labels
unexpected behaviourResult is unexpected, but not entirely wrong at the same time.Result is unexpected, but not entirely wrong at the same time.