rpbouman / huey

A UI for DuckDB
MIT License
182 stars 14 forks source link

Error when using a DuckDB view as source which makes use of CTEs #79

Open IvoMoor opened 4 months ago

IvoMoor commented 4 months ago

A view that makes use of CTEs in a duckdb file cannot be used as a source. When trying to select it, the console shows an error indicating that the table could not be found.

Steps to reproduce: Create a duckdb file with a table: create table Cities as select * from (values ('Amsterdam', 1), ('London', 2)) Cities(Name, Id);

On top create a view that uses a CTE: create or replace view v_cities as select * from Cities;

Use the created duckdb file as a source and select the view. Huey will show an indicator that it is loading the metadata, but when opening the console, it turns out that there is an error: Uncaught (in promise) Error: Catalog Error: Table with name Cities does not exist! Did you mean "xxx.Cities"?