1-- Regression test for this issue:
2-- https://github.com/citusdata/citus/issues/3622
3SET citus.shard_count = 4;
4SET citus.next_shard_id TO 1954000;
5CREATE SCHEMA rollback_to_savepoint;
6SET search_path TO rollback_to_savepoint;
7
8CREATE TABLE t(a int);
9SELECT create_distributed_table('t', 'a');
10
11-- This timeout is chosen such that the INSERT with
12-- generate_series(1, 100000000) is cancelled at the right time to trigger the
13-- bug
14SET statement_timeout = '2s';
15BEGIN;
16INSERT INTO t VALUES (4);
17SAVEPOINT s1;
18INSERT INTO t SELECT i FROM generate_series(1, 10000000) i;
19ROLLBACK TO SAVEPOINT s1;
20INSERT INTO t SELECT i FROM generate_series(1, 100) i;
21ROLLBACK;
22
23DROP SCHEMA rollback_to_savepoint CASCADE;
24