Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.11, 11.8
-
None
-
None
Description
I can use a CTE with SELECTs:
with |
cnt(country) as (values('India')), |
cities(city) as (values('New Delhi'),('Jaipur'),('Shimla')) |
select country, city from cnt, cities; |
gives
+---------+-----------+
|
| country | city |
|
+---------+-----------+
|
| India | New Delhi |
|
| India | Jaipur |
|
| India | Shimla |
|
+---------+-----------+
|
3 rows in set (0.003 sec)
|
but when I try to use them with INSERT...SELECT, I get a parse error:
create table t1(a varchar(10), b varchar(10)); |
with |
cnt(country) as (values('India')), |
cities(city) as (values('New Delhi'),('Jaipur'),('Shimla')) |
insert into t1 |
select country, city from cnt, cities; |
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'insert into t1
|
select country, city from cnt, cities' at line 4
|
A simpler example
One doesn't TVCs:
create table t12(a int);
|
create table t11(a int);
|
with T as (select * from t12)insert into t11 select * from t12;
|
Neither example seems supported by MySQL.
Both are supported by PostgreSQL.
I don't see the reason for such limitation to exist.
Attachments
Issue Links
- relates to
-
MDEV-35388 PostgreSQL-compatible syntax
-
- Open
-