v.24.10New Feature
Support for CTE in INSERT Statements
Support for CTE in the form ofWITH ... INSERT, as previously we only supportedINSERT ... WITH .... #70593 (Shichao Jin).
Why it matters
This feature allows users to write queries where the CTE is defined before theINSERT statement, improving query readability and flexibility. It resolves the limitation of only being able to use CTEs after INSERT, enabling more intuitive and versatile data insertion workflows.How to use it
Users can now place theWITH clause before the INSERT statement in their SQL queries, for example:WITH cte AS (<query>)
INSERT INTO <table> SELECT * FROM cte