Title
#users-public
j

John Lewis

11/02/2022, 3:51 PM
create table 'conndata2' ( ts timestamp, name string, active string ) timestamp(ts); -- this works insert into conndata2 SELECT '1970-01-01T00:00:00', 'A', 'Y' UNION ALL SELECT '1970-01-01T00:00:01', 'E', 'Y' TRUNCATE TABLE conndata2 -- this doesnt work - get table done not exist with cte_getdata as ( SELECT '1970-01-01T00:00:00' ts, 'A' name, 'Y' active UNION ALL SELECT '1970-01-01T00:00:01', 'E', 'Y' ) insert into conndata2 select ts, name, active from cte_getdata
Vlad

Vlad

11/02/2022, 6:09 PM
questdb doesn't support
insert into tab with...
syntax yet, it could, we just overlooked this type of SQL
6:09 PM
you can rewrite your SQL without using WITH:
6:09 PM
insert into conndata2 select ts, name, active from (
SELECT           '1970-01-01T00:00:00' ts, 'A' name, 'Y' active
UNION ALL SELECT '1970-01-01T00:00:01', 'E', 'Y'
);
j

John Lewis

11/02/2022, 6:16 PM
Understood, my actual queries are pretty complex and CTEs are a great way to layout and organize complex queries. Not being able to use CTEs makes the rewritten queries more difficult to understand and maintain. Do you known if this likely to be supported in future? Thanks
Vlad

Vlad

11/03/2022, 11:22 AM
Absolutely, this is very easy to support! If you care enough to create issue, we will implement it right away!
j

John Lewis

11/03/2022, 11:43 AM
Thank you so much, that would be wonderful. I've raised issue https://github.com/questdb/questdb/issues/2719 Please let me know when fix version is available. Thanks