문제

I trying to perform something like

CREATE TEMP TABLE tblname AS (
  INSERT INTO tbl2 FROM SELECT(1,1) RETURNING a,b 
);

but i've got ERROR: syntax error at or near "INSERT";

Is it possible to combine CREATE TABLE AS SELECT and INSERT FROM SELECT RETURNING clauses?

도움이 되었습니까?

해결책

create temp table tblname as
    with i as (
        insert into tbl2 (a, b)
        select 1, 1
        returning a,b 
    )
    select a, b
    from i
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top