Just as a note this query will also give an error in PostgreSQL as well: > insert into t0log (whenCreated,what) with stuffer as (INSERT INTO t0(c) VALUES(random()) RETURNING b,c) select b,c; ` testing=> insert into t0log (when_created, what) with stuffer as (insert into t0 (c) values (random()) returning b, c) select b, c; ERROR: WITH clause containing a data-modifying statement must be at the top level LINE 1: insert into t0log (when_created, what) with stuffer as (inse... ^ Time: 13.069 ms ` And needs to be re-written with the WITH part first. ` testing=> with stuffer as (insert into t0 (c) values (random()) returning b, c) insert into t0log (when_created, what) select b, c from stuffer; INSERT 0 1 Time: 0.934 ms `