Postgresql Datagrip中的多个选择(运行嵌套查询中没有的CTE)

Postgresql Datagrip中的多个选择(运行嵌套查询中没有的CTE),postgresql,common-table-expression,datagrip,Postgresql,Common Table Expression,Datagrip,我正在寻找一种运行嵌套相关查询的方法,该查询需要在脚本上方创建一个CTE。例如,如果我有: with first_cte as ( select * from a_table where 1=1 ) select * from (select column_1, column_2, column_3 from b_table b inner join first_cte f on f.user_id = b.user_id w

我正在寻找一种运行嵌套相关查询的方法,该查询需要在脚本上方创建一个CTE。例如,如果我有:

with first_cte as (
  select * 
  from a_table 
  where 1=1
)

select * from 
  (select 
    column_1,
    column_2,
    column_3
  from b_table b
    inner join first_cte f on f.user_id = b.user_id
    where 1=1) x
如果我只是想测试嵌套查询,它会说first_cte不存在。有没有办法突出显示CTE,以便在测试嵌套查询时运行它

顺便说一句,我正在使用PostgreSQL。谢谢

在DataGrip中有两个


是否将WITH转换为临时表?因此,将“使用first_cte AS”更改为“创建临时表first_cte AS();”。记得加上;之后这样做将允许您test@MassiveOwl创建临时表非常有效!!!非常感谢你。