You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DB:Exception: Qualified matcher reservation.* found a non-compound expression #82151
WITH
reservations_enriched as
(SELECT reservations.*
FROM datasources_guesty.import_reservations reservations
WHERE reservations.unit_id = 1585),
stays as
(SELECT 1 as reservations
FROM reservations_enriched)
SELECT *
FROM stays
In import_reservations table I don't have column named reservations.
When I execute it I have this error
To fix it
I can apply SETTING allow_experimental_analyzer = 0 (but I would avoid)
I can rename one alias reservations by another name (but I don't understand the reason)
I would like to know the reason and how to fix it properly
The new analyzer is stricter about scope resolution. In your query, the call to reservations_enriched in the stays CTE causes ClickHouse to try and resolve reservations.*, which in that context disambiguates to the reservations column in the current scope — a single column of type UInt8.
The simplest way to rewrite your query is to replace reservations.* with *. Not sure what you're trying to achieve with this query, but there's a chance it could be optimized to reduce the amount of data scanned if all you need is a membership check that stops at the first match.
Closing, but tagging @KochetovNicolai for a second pair of eyes in case I'm misinterpreting the behavior of the new analyzer.
It's a simple sample here, just to reproduce the issue.
We finally replaced reservations.* by the columns we need directly (we can't use * in our final query, many left join..)
MariaDB [dw]> WITH
-> reservations_enriched as
-> (SELECT reservations.*
-> FROM (select 1585 as unit_id, 2 as y) reservations
-> WHERE reservations.unit_id = 1585),
->
-> stays as
-> (SELECT 1 as reservations FROM reservations_enriched)
-> SELECT *
-> FROM stays;
+--------------+
| reservations |
+--------------+
| 1 |
+--------------+
1 row in set (0.000 sec)
psql> WITH
reservations_enriched as
(SELECT reservations.*
FROM (select 1585 as unit_id, 2 as y) reservations
WHERE reservations.unit_id = 1585),
stays as
(SELECT 1 as reservations FROM reservations_enriched)
SELECT *
FROM stays;
1
./duckdb
v0.8.1 6536a77232
Enter ".help" for usage hints.
Connected to a transient in-memory database.
Use ".open FILENAME" to reopen on a persistent database.
D WITH
> reservations_enriched as
> (SELECT reservations.*
> FROM (select 1585 as unit_id, 2 as y) reservations
> WHERE reservations.unit_id = 1585),
>
> stays as
> (SELECT 1 as reservations FROM reservations_enriched)
> SELECT *
> FROM stays;
┌──────────────┐
│ reservations │
│ int32 │
├──────────────┤
│ 1 │
└──────────────┘
Activity
morsapaes commentedon Jun 19, 2025
The new analyzer is stricter about scope resolution. In your query, the call to
reservations_enrichedin thestaysCTE causes ClickHouse to try and resolvereservations.*, which in that context disambiguates to thereservationscolumn in the current scope — a single column of typeUInt8.The simplest way to rewrite your query is to replace
reservations.*with*. Not sure what you're trying to achieve with this query, but there's a chance it could be optimized to reduce the amount of data scanned if all you need is a membership check that stops at the first match.Closing, but tagging @KochetovNicolai for a second pair of eyes in case I'm misinterpreting the behavior of the new analyzer.
apausepi commentedon Jun 19, 2025
Thanks,
It's a simple sample here, just to reproduce the issue.
We finally replaced reservations.* by the columns we need directly (we can't use * in our final query, many left join..)
den-crane commentedon Jun 20, 2025
@morsapaes