9. Writable Arrow_Fdw 外部テーブルを定義する
▌ポイント
① 外部テーブルのバックエンドに指定するファイルは1個だけ
② writableオプションに ‘true’ を指定する。
▌定義例
=# CREATE FOREIGN TABLE ft (
id int,
x real,
y real,
z real
) SERVER arrow_fdw
OPTIONS (file '/dev/shm/ft.arrow', writable 'true');
CREATE FOREIGN TABLE
PostgreSQL Unconference Apr-20209
14. ROLLBACKもできるYO!!
postgres=# INSERT INTO ft VALUES (1,'Tokyo'),(2,'Osaka');
INSERT 0 2
postgres=# BEGIN;
BEGIN
postgres=# INSERT INTO ft VALUES (3,'Nagoya'),(4,'Kyoto');
INSERT 0 2
postgres=# SELECT * FROM ft;
id | x
----+--------
1 | Tokyo
2 | Osaka
3 | Nagoya
4 | Kyoto
(4 rows)
PostgreSQL Unconference Apr-202014
15. ROLLBACKもできるYO!!
postgres=# SAVEPOINT sv;
SAVEPOINT
postgres=# INSERT INTO ft VALUES (5, 'Yokohama');
INSERT 0 1
postgres=# SELECT * FROM ft;
id | x
----+----------
1 | Tokyo
2 | Osaka
3 | Nagoya
4 | Kyoto
5 | Yokohama
(5 rows)
PostgreSQL Unconference Apr-202015
16. ROLLBACKもできるYO!!
postgres=# ROLLBACK TO sv;
ROLLBACK
postgres=# SELECT * FROM ft;
id | x
----+--------
1 | Tokyo
2 | Osaka
3 | Nagoya
4 | Kyoto
(4 rows)
postgres=# ABORT;
ROLLBACK
postgres=# SELECT * FROM ft;
id | x
----+-------
1 | Tokyo
2 | Osaka
(2 rows)
PostgreSQL Unconference Apr-202016