unused step name: s3-debug
Parsed test spec with 3 sessions

starting permutation: s3-compare-snapshot
step s3-compare-snapshot:
 SELECT count(*) = 0 AS same_metadata_in_workers
 FROM
 (
  (
   SELECT unnest(activate_node_snapshot())
    EXCEPT
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
  )
 UNION
  (
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
    EXCEPT
   SELECT unnest(activate_node_snapshot())
  )
 ) AS foo;

same_metadata_in_workers
---------------------------------------------------------------------
t
(1 row)


starting permutation: s1-begin s2-begin s1-start-metadata-sync s2-start-metadata-sync-to-same-node s1-commit s2-commit s3-compare-snapshot
step s1-begin:
    BEGIN;

step s2-begin:
 BEGIN;

step s1-start-metadata-sync:
 SELECT start_metadata_sync_to_node('localhost', 57638);

start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s2-start-metadata-sync-to-same-node:
 SELECT start_metadata_sync_to_node('localhost', 57638);
 <waiting ...>
step s1-commit: 
    COMMIT;

step s2-start-metadata-sync-to-same-node: <... completed>
start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s2-commit:
 COMMIT;

step s3-compare-snapshot:
 SELECT count(*) = 0 AS same_metadata_in_workers
 FROM
 (
  (
   SELECT unnest(activate_node_snapshot())
    EXCEPT
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
  )
 UNION
  (
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
    EXCEPT
   SELECT unnest(activate_node_snapshot())
  )
 ) AS foo;

same_metadata_in_workers
---------------------------------------------------------------------
t
(1 row)


starting permutation: s1-begin s2-begin s1-start-metadata-sync s2-start-metadata-sync-to-another-node s1-commit s2-commit s3-compare-snapshot
step s1-begin:
    BEGIN;

step s2-begin:
 BEGIN;

step s1-start-metadata-sync:
 SELECT start_metadata_sync_to_node('localhost', 57638);

start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s2-start-metadata-sync-to-another-node:
 SELECT start_metadata_sync_to_node('localhost', 57637);
 <waiting ...>
step s1-commit: 
    COMMIT;

step s2-start-metadata-sync-to-another-node: <... completed>
start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s2-commit:
 COMMIT;

step s3-compare-snapshot:
 SELECT count(*) = 0 AS same_metadata_in_workers
 FROM
 (
  (
   SELECT unnest(activate_node_snapshot())
    EXCEPT
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
  )
 UNION
  (
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
    EXCEPT
   SELECT unnest(activate_node_snapshot())
  )
 ) AS foo;

same_metadata_in_workers
---------------------------------------------------------------------
t
(1 row)


starting permutation: s1-begin s2-begin s1-start-metadata-sync s2-alter-table s1-commit s2-commit s3-compare-snapshot
step s1-begin:
    BEGIN;

step s2-begin:
 BEGIN;

step s1-start-metadata-sync:
 SELECT start_metadata_sync_to_node('localhost', 57638);

start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s2-alter-table:
 ALTER TABLE dist_table ADD COLUMN z int;
 <waiting ...>
step s1-commit: 
    COMMIT;

step s2-alter-table: <... completed>
step s2-commit:
 COMMIT;

step s3-compare-snapshot:
 SELECT count(*) = 0 AS same_metadata_in_workers
 FROM
 (
  (
   SELECT unnest(activate_node_snapshot())
    EXCEPT
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
  )
 UNION
  (
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
    EXCEPT
   SELECT unnest(activate_node_snapshot())
  )
 ) AS foo;

same_metadata_in_workers
---------------------------------------------------------------------
t
(1 row)


starting permutation: s1-begin s2-begin s1-start-metadata-sync s2-drop-table s1-commit s2-commit s3-compare-snapshot
step s1-begin:
    BEGIN;

step s2-begin:
 BEGIN;

step s1-start-metadata-sync:
 SELECT start_metadata_sync_to_node('localhost', 57638);

start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s2-drop-table:
 DROP TABLE dist_table;
 <waiting ...>
step s1-commit: 
    COMMIT;

step s2-drop-table: <... completed>
step s2-commit:
 COMMIT;

step s3-compare-snapshot:
 SELECT count(*) = 0 AS same_metadata_in_workers
 FROM
 (
  (
   SELECT unnest(activate_node_snapshot())
    EXCEPT
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
  )
 UNION
  (
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
    EXCEPT
   SELECT unnest(activate_node_snapshot())
  )
 ) AS foo;

same_metadata_in_workers
---------------------------------------------------------------------
t
(1 row)


starting permutation: s1-begin s2-begin s1-start-metadata-sync s2-create-schema s1-commit s2-commit s3-compare-snapshot s2-drop-schema
step s1-begin:
    BEGIN;

step s2-begin:
 BEGIN;

step s1-start-metadata-sync:
 SELECT start_metadata_sync_to_node('localhost', 57638);

start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s2-create-schema:
 CREATE SCHEMA dist_schema;
 CREATE TABLE dist_schema.dist_table_in_schema(id int, data int);
 SELECT create_distributed_table('dist_schema.dist_table_in_schema', 'id');
 <waiting ...>
step s1-commit: 
    COMMIT;

step s2-create-schema: <... completed>
create_distributed_table
---------------------------------------------------------------------

(1 row)

step s2-commit:
 COMMIT;

step s3-compare-snapshot:
 SELECT count(*) = 0 AS same_metadata_in_workers
 FROM
 (
  (
   SELECT unnest(activate_node_snapshot())
    EXCEPT
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
  )
 UNION
  (
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
    EXCEPT
   SELECT unnest(activate_node_snapshot())
  )
 ) AS foo;

same_metadata_in_workers
---------------------------------------------------------------------
t
(1 row)

step s2-drop-schema:
 DROP SCHEMA dist_schema CASCADE;


starting permutation: s2-create-schema s1-begin s2-begin s1-start-metadata-sync s2-drop-schema s1-commit s2-commit s3-compare-snapshot
step s2-create-schema:
 CREATE SCHEMA dist_schema;
 CREATE TABLE dist_schema.dist_table_in_schema(id int, data int);
 SELECT create_distributed_table('dist_schema.dist_table_in_schema', 'id');

create_distributed_table
---------------------------------------------------------------------

(1 row)

step s1-begin:
    BEGIN;

step s2-begin:
 BEGIN;

step s1-start-metadata-sync:
 SELECT start_metadata_sync_to_node('localhost', 57638);

start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s2-drop-schema:
 DROP SCHEMA dist_schema CASCADE;
 <waiting ...>
step s1-commit: 
    COMMIT;

step s2-drop-schema: <... completed>
step s2-commit:
 COMMIT;

step s3-compare-snapshot:
 SELECT count(*) = 0 AS same_metadata_in_workers
 FROM
 (
  (
   SELECT unnest(activate_node_snapshot())
    EXCEPT
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
  )
 UNION
  (
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
    EXCEPT
   SELECT unnest(activate_node_snapshot())
  )
 ) AS foo;

same_metadata_in_workers
---------------------------------------------------------------------
t
(1 row)


starting permutation: s1-begin s2-begin s1-start-metadata-sync s2-create-dist-table s1-commit s2-commit
step s1-begin:
    BEGIN;

step s2-begin:
 BEGIN;

step s1-start-metadata-sync:
 SELECT start_metadata_sync_to_node('localhost', 57638);

start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s2-create-dist-table:
 CREATE TABLE new_dist_table(id int, data int);
 SELECT create_distributed_table('new_dist_table', 'id');
 <waiting ...>
step s1-commit: 
    COMMIT;

step s2-create-dist-table: <... completed>
create_distributed_table
---------------------------------------------------------------------

(1 row)

step s2-commit:
 COMMIT;


starting permutation: s1-begin s2-begin s1-start-metadata-sync s2-create-ref-table s1-commit s2-commit s3-compare-snapshot
step s1-begin:
    BEGIN;

step s2-begin:
 BEGIN;

step s1-start-metadata-sync:
 SELECT start_metadata_sync_to_node('localhost', 57638);

start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s2-create-ref-table:
 CREATE TABLE new_ref_table(id int, data int);
 SELECT create_reference_table('new_ref_table');
 <waiting ...>
step s1-commit: 
    COMMIT;

step s2-create-ref-table: <... completed>
create_reference_table
---------------------------------------------------------------------

(1 row)

step s2-commit:
 COMMIT;

step s3-compare-snapshot:
 SELECT count(*) = 0 AS same_metadata_in_workers
 FROM
 (
  (
   SELECT unnest(activate_node_snapshot())
    EXCEPT
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
  )
 UNION
  (
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
    EXCEPT
   SELECT unnest(activate_node_snapshot())
  )
 ) AS foo;

same_metadata_in_workers
---------------------------------------------------------------------
t
(1 row)


starting permutation: s1-begin s2-begin s1-start-metadata-sync s2-attach-partition s1-commit s2-commit s3-compare-snapshot
step s1-begin:
    BEGIN;

step s2-begin:
 BEGIN;

step s1-start-metadata-sync:
 SELECT start_metadata_sync_to_node('localhost', 57638);

start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s2-attach-partition:
 ALTER TABLE dist_partitioned_table ATTACH PARTITION dist_partitioned_table_p1 FOR VALUES FROM (1) TO (9);
 <waiting ...>
step s1-commit: 
    COMMIT;

step s2-attach-partition: <... completed>
step s2-commit:
 COMMIT;

step s3-compare-snapshot:
 SELECT count(*) = 0 AS same_metadata_in_workers
 FROM
 (
  (
   SELECT unnest(activate_node_snapshot())
    EXCEPT
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
  )
 UNION
  (
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
    EXCEPT
   SELECT unnest(activate_node_snapshot())
  )
 ) AS foo;

same_metadata_in_workers
---------------------------------------------------------------------
t
(1 row)


starting permutation: s2-attach-partition s1-begin s2-begin s1-start-metadata-sync s2-detach-partition s1-commit s2-commit s3-compare-snapshot
step s2-attach-partition:
 ALTER TABLE dist_partitioned_table ATTACH PARTITION dist_partitioned_table_p1 FOR VALUES FROM (1) TO (9);

step s1-begin:
    BEGIN;

step s2-begin:
 BEGIN;

step s1-start-metadata-sync:
 SELECT start_metadata_sync_to_node('localhost', 57638);

start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s2-detach-partition:
 ALTER TABLE dist_partitioned_table DETACH PARTITION dist_partitioned_table_p1;
 <waiting ...>
step s1-commit: 
    COMMIT;

step s2-detach-partition: <... completed>
step s2-commit:
 COMMIT;

step s3-compare-snapshot:
 SELECT count(*) = 0 AS same_metadata_in_workers
 FROM
 (
  (
   SELECT unnest(activate_node_snapshot())
    EXCEPT
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
  )
 UNION
  (
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
    EXCEPT
   SELECT unnest(activate_node_snapshot())
  )
 ) AS foo;

same_metadata_in_workers
---------------------------------------------------------------------
t
(1 row)


starting permutation: s2-attach-partition s1-begin s2-begin s1-start-metadata-sync s2-create-partition-of s1-commit s2-commit s3-compare-snapshot
step s2-attach-partition:
 ALTER TABLE dist_partitioned_table ATTACH PARTITION dist_partitioned_table_p1 FOR VALUES FROM (1) TO (9);

step s1-begin:
    BEGIN;

step s2-begin:
 BEGIN;

step s1-start-metadata-sync:
 SELECT start_metadata_sync_to_node('localhost', 57638);

start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s2-create-partition-of:
 CREATE TABLE dist_partitioned_table_p2 PARTITION OF dist_partitioned_table FOR VALUES FROM (10) TO (20);
 <waiting ...>
step s1-commit: 
    COMMIT;

step s2-create-partition-of: <... completed>
step s2-commit:
 COMMIT;

step s3-compare-snapshot:
 SELECT count(*) = 0 AS same_metadata_in_workers
 FROM
 (
  (
   SELECT unnest(activate_node_snapshot())
    EXCEPT
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
  )
 UNION
  (
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
    EXCEPT
   SELECT unnest(activate_node_snapshot())
  )
 ) AS foo;

same_metadata_in_workers
---------------------------------------------------------------------
t
(1 row)


starting permutation: s1-begin s2-begin s1-start-metadata-sync s2-add-fk s1-commit s2-commit s3-compare-snapshot
step s1-begin:
    BEGIN;

step s2-begin:
 BEGIN;

step s1-start-metadata-sync:
 SELECT start_metadata_sync_to_node('localhost', 57638);

start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s2-add-fk:
 ALTER TABLE dist_table ADD CONSTRAINT y_fk FOREIGN KEY (y) REFERENCES ref_table(y);
 <waiting ...>
step s1-commit: 
    COMMIT;

step s2-add-fk: <... completed>
step s2-commit:
 COMMIT;

step s3-compare-snapshot:
 SELECT count(*) = 0 AS same_metadata_in_workers
 FROM
 (
  (
   SELECT unnest(activate_node_snapshot())
    EXCEPT
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
  )
 UNION
  (
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
    EXCEPT
   SELECT unnest(activate_node_snapshot())
  )
 ) AS foo;

same_metadata_in_workers
---------------------------------------------------------------------
t
(1 row)


starting permutation: s2-add-fk s1-begin s2-begin s1-start-metadata-sync s2-drop-fk s1-commit s2-commit s3-compare-snapshot
step s2-add-fk:
 ALTER TABLE dist_table ADD CONSTRAINT y_fk FOREIGN KEY (y) REFERENCES ref_table(y);

step s1-begin:
    BEGIN;

step s2-begin:
 BEGIN;

step s1-start-metadata-sync:
 SELECT start_metadata_sync_to_node('localhost', 57638);

start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s2-drop-fk:
 ALTER TABLE dist_table DROP CONSTRAINT y_fk;
 <waiting ...>
step s1-commit: 
    COMMIT;

step s2-drop-fk: <... completed>
step s2-commit:
 COMMIT;

step s3-compare-snapshot:
 SELECT count(*) = 0 AS same_metadata_in_workers
 FROM
 (
  (
   SELECT unnest(activate_node_snapshot())
    EXCEPT
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
  )
 UNION
  (
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
    EXCEPT
   SELECT unnest(activate_node_snapshot())
  )
 ) AS foo;

same_metadata_in_workers
---------------------------------------------------------------------
t
(1 row)


starting permutation: s2-create-type s1-begin s2-begin s1-start-metadata-sync s2-drop-type s1-commit s2-commit s3-compare-snapshot
step s2-create-type:
 CREATE TYPE my_type AS (a int, b int);

step s1-begin:
    BEGIN;

step s2-begin:
 BEGIN;

step s1-start-metadata-sync:
 SELECT start_metadata_sync_to_node('localhost', 57638);

start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s2-drop-type:
 DROP TYPE my_type;
 <waiting ...>
step s1-commit: 
    COMMIT;

step s2-drop-type: <... completed>
step s2-commit:
 COMMIT;

step s3-compare-snapshot:
 SELECT count(*) = 0 AS same_metadata_in_workers
 FROM
 (
  (
   SELECT unnest(activate_node_snapshot())
    EXCEPT
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
  )
 UNION
  (
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
    EXCEPT
   SELECT unnest(activate_node_snapshot())
  )
 ) AS foo;

same_metadata_in_workers
---------------------------------------------------------------------
t
(1 row)


starting permutation: s2-create-dist-func s1-begin s2-begin s1-start-metadata-sync s2-drop-dist-func s1-commit s2-commit s3-compare-snapshot
step s2-create-dist-func:
 CREATE FUNCTION squares(int) RETURNS SETOF RECORD
    AS $$ SELECT i, i * i FROM generate_series(1, $1) i $$
    LANGUAGE SQL;
 SELECT create_distributed_function('squares(int)');

create_distributed_function
---------------------------------------------------------------------

(1 row)

step s1-begin:
    BEGIN;

step s2-begin:
 BEGIN;

step s1-start-metadata-sync:
 SELECT start_metadata_sync_to_node('localhost', 57638);

start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s2-drop-dist-func:
 DROP FUNCTION squares(int);
 <waiting ...>
step s1-commit: 
    COMMIT;

step s2-drop-dist-func: <... completed>
step s2-commit:
 COMMIT;

step s3-compare-snapshot:
 SELECT count(*) = 0 AS same_metadata_in_workers
 FROM
 (
  (
   SELECT unnest(activate_node_snapshot())
    EXCEPT
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
  )
 UNION
  (
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
    EXCEPT
   SELECT unnest(activate_node_snapshot())
  )
 ) AS foo;

same_metadata_in_workers
---------------------------------------------------------------------
t
(1 row)


starting permutation: s2-create-type s1-begin s1-start-metadata-sync s2-alter-type s1-commit s3-compare-snapshot s3-compare-type-definition
step s2-create-type:
 CREATE TYPE my_type AS (a int, b int);

step s1-begin:
    BEGIN;

step s1-start-metadata-sync:
 SELECT start_metadata_sync_to_node('localhost', 57638);

start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s2-alter-type:
 ALTER TYPE my_type ADD ATTRIBUTE x int;
 <waiting ...>
step s1-commit: 
    COMMIT;

step s2-alter-type: <... completed>
step s3-compare-snapshot:
 SELECT count(*) = 0 AS same_metadata_in_workers
 FROM
 (
  (
   SELECT unnest(activate_node_snapshot())
    EXCEPT
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
  )
 UNION
  (
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
    EXCEPT
   SELECT unnest(activate_node_snapshot())
  )
 ) AS foo;

same_metadata_in_workers
---------------------------------------------------------------------
t
(1 row)

step s3-compare-type-definition:
 SELECT run_command_on_workers($$SELECT '(1,1,1)'::my_type$$);

run_command_on_workers
---------------------------------------------------------------------
(localhost,57637,t,"(1,1,1)")
(localhost,57638,t,"(1,1,1)")
(2 rows)


starting permutation: s1-begin s2-begin s2-create-dist-table s1-start-metadata-sync s2-commit s1-commit s3-compare-snapshot
step s1-begin:
    BEGIN;

step s2-begin:
 BEGIN;

step s2-create-dist-table:
 CREATE TABLE new_dist_table(id int, data int);
 SELECT create_distributed_table('new_dist_table', 'id');

create_distributed_table
---------------------------------------------------------------------

(1 row)

step s1-start-metadata-sync:
 SELECT start_metadata_sync_to_node('localhost', 57638);
 <waiting ...>
step s2-commit: 
 COMMIT;

step s1-start-metadata-sync: <... completed>
start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s1-commit:
    COMMIT;

step s3-compare-snapshot:
 SELECT count(*) = 0 AS same_metadata_in_workers
 FROM
 (
  (
   SELECT unnest(activate_node_snapshot())
    EXCEPT
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
  )
 UNION
  (
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
    EXCEPT
   SELECT unnest(activate_node_snapshot())
  )
 ) AS foo;

same_metadata_in_workers
---------------------------------------------------------------------
t
(1 row)


starting permutation: s2-create-dist-func s1-begin s2-begin s2-drop-dist-func s1-start-metadata-sync s2-commit s1-commit s3-compare-snapshot
step s2-create-dist-func:
 CREATE FUNCTION squares(int) RETURNS SETOF RECORD
    AS $$ SELECT i, i * i FROM generate_series(1, $1) i $$
    LANGUAGE SQL;
 SELECT create_distributed_function('squares(int)');

create_distributed_function
---------------------------------------------------------------------

(1 row)

step s1-begin:
    BEGIN;

step s2-begin:
 BEGIN;

step s2-drop-dist-func:
 DROP FUNCTION squares(int);

step s1-start-metadata-sync:
 SELECT start_metadata_sync_to_node('localhost', 57638);
 <waiting ...>
step s2-commit: 
 COMMIT;

step s1-start-metadata-sync: <... completed>
start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s1-commit:
    COMMIT;

step s3-compare-snapshot:
 SELECT count(*) = 0 AS same_metadata_in_workers
 FROM
 (
  (
   SELECT unnest(activate_node_snapshot())
    EXCEPT
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
  )
 UNION
  (
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
    EXCEPT
   SELECT unnest(activate_node_snapshot())
  )
 ) AS foo;

same_metadata_in_workers
---------------------------------------------------------------------
t
(1 row)


starting permutation: s2-create-schema s1-begin s2-begin s2-drop-schema s1-start-metadata-sync s2-commit s1-commit s3-compare-snapshot
step s2-create-schema:
 CREATE SCHEMA dist_schema;
 CREATE TABLE dist_schema.dist_table_in_schema(id int, data int);
 SELECT create_distributed_table('dist_schema.dist_table_in_schema', 'id');

create_distributed_table
---------------------------------------------------------------------

(1 row)

step s1-begin:
    BEGIN;

step s2-begin:
 BEGIN;

step s2-drop-schema:
 DROP SCHEMA dist_schema CASCADE;

step s1-start-metadata-sync:
 SELECT start_metadata_sync_to_node('localhost', 57638);
 <waiting ...>
step s2-commit: 
 COMMIT;

step s1-start-metadata-sync: <... completed>
start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s1-commit:
    COMMIT;

step s3-compare-snapshot:
 SELECT count(*) = 0 AS same_metadata_in_workers
 FROM
 (
  (
   SELECT unnest(activate_node_snapshot())
    EXCEPT
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
  )
 UNION
  (
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
    EXCEPT
   SELECT unnest(activate_node_snapshot())
  )
 ) AS foo;

same_metadata_in_workers
---------------------------------------------------------------------
t
(1 row)


starting permutation: s2-create-type s1-begin s2-begin s2-alter-type s1-start-metadata-sync s2-commit s1-commit s3-compare-snapshot s3-compare-type-definition
step s2-create-type:
 CREATE TYPE my_type AS (a int, b int);

step s1-begin:
    BEGIN;

step s2-begin:
 BEGIN;

step s2-alter-type:
 ALTER TYPE my_type ADD ATTRIBUTE x int;

step s1-start-metadata-sync:
 SELECT start_metadata_sync_to_node('localhost', 57638);
 <waiting ...>
step s2-commit: 
 COMMIT;

step s1-start-metadata-sync: <... completed>
start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s1-commit:
    COMMIT;

step s3-compare-snapshot:
 SELECT count(*) = 0 AS same_metadata_in_workers
 FROM
 (
  (
   SELECT unnest(activate_node_snapshot())
    EXCEPT
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
  )
 UNION
  (
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
    EXCEPT
   SELECT unnest(activate_node_snapshot())
  )
 ) AS foo;

same_metadata_in_workers
---------------------------------------------------------------------
t
(1 row)

step s3-compare-type-definition:
 SELECT run_command_on_workers($$SELECT '(1,1,1)'::my_type$$);

run_command_on_workers
---------------------------------------------------------------------
(localhost,57637,t,"(1,1,1)")
(localhost,57638,t,"(1,1,1)")
(2 rows)


starting permutation: s1-begin s2-begin s1-start-metadata-sync s2-create-type s1-commit s2-commit s3-compare-snapshot
step s1-begin:
    BEGIN;

step s2-begin:
 BEGIN;

step s1-start-metadata-sync:
 SELECT start_metadata_sync_to_node('localhost', 57638);

start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s2-create-type:
 CREATE TYPE my_type AS (a int, b int);
 <waiting ...>
step s1-commit: 
    COMMIT;

step s2-create-type: <... completed>
step s2-commit:
 COMMIT;

step s3-compare-snapshot:
 SELECT count(*) = 0 AS same_metadata_in_workers
 FROM
 (
  (
   SELECT unnest(activate_node_snapshot())
    EXCEPT
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
  )
 UNION
  (
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
    EXCEPT
   SELECT unnest(activate_node_snapshot())
  )
 ) AS foo;

same_metadata_in_workers
---------------------------------------------------------------------
t
(1 row)


starting permutation: s1-begin s2-begin s1-start-metadata-sync s2-create-dist-func s1-commit s2-commit s3-compare-snapshot
step s1-begin:
    BEGIN;

step s2-begin:
 BEGIN;

step s1-start-metadata-sync:
 SELECT start_metadata_sync_to_node('localhost', 57638);

start_metadata_sync_to_node
---------------------------------------------------------------------

(1 row)

step s2-create-dist-func:
 CREATE FUNCTION squares(int) RETURNS SETOF RECORD
    AS $$ SELECT i, i * i FROM generate_series(1, $1) i $$
    LANGUAGE SQL;
 SELECT create_distributed_function('squares(int)');
 <waiting ...>
step s1-commit: 
    COMMIT;

step s2-create-dist-func: <... completed>
create_distributed_function
---------------------------------------------------------------------

(1 row)

step s2-commit:
 COMMIT;

step s3-compare-snapshot:
 SELECT count(*) = 0 AS same_metadata_in_workers
 FROM
 (
  (
   SELECT unnest(activate_node_snapshot())
    EXCEPT
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
  )
 UNION
  (
   SELECT unnest(result::text[]) AS unnested_result
   FROM run_command_on_workers($$SELECT activate_node_snapshot()$$)
    EXCEPT
   SELECT unnest(activate_node_snapshot())
  )
 ) AS foo;

same_metadata_in_workers
---------------------------------------------------------------------
t
(1 row)

