PSQL 中的 CTE/with 子句

CTE/with clause in PSQL

我收到错误:

syntax error at or near "INSERT"* on executing the following:

WITH
    sq as (select * from input_client)
INSERT INTO cleaned
select *
  from weekly
    cross join sq;

语法参考(red)手册: https://www.postgresql.org/docs/9.1/static/queries-with.html

INSERT INTO cleaned
select w.*
from weekly w, input_client;

如果你只想要 input_client 和每周的笛卡尔积,就这样写。