singlestore-labs / singlestoredb-laravel-driver

The official SingleStore Laravel driver.
https://github.com/singlestore-labs/singlestore-laravel-driver
Apache License 2.0
223 stars 22 forks source link

Modified generation of the union queries #67

Closed AdalbertMemSQL closed 1 year ago

AdalbertMemSQL commented 1 year ago

Previously it generated union queries like SELECT FROM (original query) UNION ALL SELECT FROM (subquery). It doesn't work with recursive CTE in S2. Now connector will generate the following queries. SELECT * from (original query) UNION ALL (subquery).

pmishchenko-ua commented 1 year ago

do we have this documented somewhere? Looks like it's pretty general limitation, our partners may encounter it as well.

AdalbertMemSQL commented 1 year ago

@pmishchenko-ua It happens only in recursive CTEs. (queries like WITH RECURSIVE cte AS (SELECT FROM t UNION ALL SELECT FROM (some other query that selects from cte)). I don't think that it is a common practice to add an additional "SELECT * FROM" to surround RCTE. So I doubt that a lot of customers will bump into it.

I didn't find this restriction in our documentation: https://docs.singlestore.com/cloud/query-data/advanced-query-topics/with-common-table-expressions/#limitations