Company or project name
No response
Describe what's wrong
When using impersonation via EXECUTE AS, the FORMAT clause specified in the SQL query is ignored and the server returns results using the default format instead.
This only affects formats specified in the SQL statement. If the format is provided through HTTP headers/params (e.g., X-ClickHouse-Format or default_format parameter), it is respected and works as expected.
This makes it difficult to control output formats in queries that rely on impersonation.
Does it reproduce on the most recent release?
Yes
How to reproduce
Assumes user with admin rights is used, and access_control_improvements.allow_impersonate_user is enabled.
clickhouse :) create user test
CREATE USER test IDENTIFIED WITH no_password
Query id: c0855cb5-65f1-43e0-971f-6a9e4fc68f62
Ok.
0 rows in set. Elapsed: 0.001 sec.
clickhouse :) execute as test select 1 format json
EXECUTE AS test
SELECT 1
FORMAT json
Query id: eb2535ba-57f8-4700-b13a-46c2e591e084
┌─1─┐
1. │ 1 │
└───┘
1 row in set. Elapsed: 0.002 sec.
clickhouse :) select 1 format json
SELECT 1
FORMAT json
Query id: eb8cef5f-6c9c-4942-af5b-420cb48f0540
{
"meta":
[
{
"name": "1",
"type": "UInt8"
}
],
"data":
[
{
"1": 1
}
],
"rows": 1,
"statistics":
{
"elapsed": 0.001413938,
"rows_read": 1,
"bytes_read": 1
}
}
1 row in set. Elapsed: 0.001 sec.
Expected behavior
The FORMAT clause specified in the query should be honored even when the query is executed through EXECUTE AS.
Error message and/or stacktrace
No response
Additional context
If the format is provided through HTTP headers/params (e.g., X-ClickHouse-Format or default_format parameter), it is respected and works as expected.
Version info
Company or project name
No response
Describe what's wrong
When using impersonation via
EXECUTE AS, theFORMATclause specified in the SQL query is ignored and the server returns results using the default format instead.This only affects formats specified in the SQL statement. If the format is provided through HTTP headers/params (e.g.,
X-ClickHouse-Formatordefault_formatparameter), it is respected and works as expected.This makes it difficult to control output formats in queries that rely on impersonation.
Does it reproduce on the most recent release?
Yes
How to reproduce
Assumes user with admin rights is used, and
access_control_improvements.allow_impersonate_useris enabled.Expected behavior
The
FORMATclause specified in the query should be honored even when the query is executed throughEXECUTE AS.Error message and/or stacktrace
No response
Additional context
If the format is provided through HTTP headers/params (e.g.,
X-ClickHouse-Formatordefault_formatparameter), it is respected and works as expected.Version info
26.4.1.22026.3.14.32