ページの先頭行へ戻る
Enterprise Postgres 17 リリース情報

2.2.155 WITH句を付ける場合の「INSERT...SELECT」の動作の変更

非互換

FUJITSU Enterprise Postgres 14では、下記の場合、「INSERT...SELECT」動作を実施不可に変更します。

FUJITSU Enterprise Postgres 13 SP1以前の場合

「INSERT...SELECT」は実施できます。

[例]

=# CREATE TEMP TABLE test AS
-# select i from generate_series(1,3) as t(i);
SELECT 3
=# CREATE TEMP TABLE test1 (i int);
CREATE TABLE
=# CREATE OR REPLACE RULE test_ins AS ON INSERT TO test
-# DO INSTEAD INSERT INTO test1 SELECT NEW.i;
CREATE RULE
=# WITH t1 AS ( DELETE FROM test RETURNING * )
-# INSERT INTO test SELECT * FROM t1;
INSERT 0 3
FUJITSU Enterprise Postgres 14の場合

「INSERT...SELECT」は実施不可になります。

[例]

=# CREATE TEMP TABLE test AS
-# select i from generate_series(1,3) as t(i);
SELECT 3
=# CREATE TEMP TABLE test1 (i int);
CREATE TABLE
=# CREATE OR REPLACE RULE test_ins AS ON INSERT TO test
-# DO INSTEAD INSERT INTO test1 SELECT NEW.i;
CREATE RULE
=# WITH t1 AS ( DELETE FROM test RETURNING * )
-# INSERT INTO test SELECT * FROM t1;
ERROR:  INSERT...SELECT rule actions are not supported for queries having data-modifying statements in WITH

対処方法

ありません。