@@ -16,6 +16,7 @@ static void check_old_cluster_has_new_cluster_dbs(void);
1616static void check_locale_and_encoding (ControlData * oldctrl ,
1717ControlData * newctrl );
1818static void check_is_super_user (ClusterInfo * cluster );
19+ static void check_for_prepared_transactions (ClusterInfo * cluster );
1920static void check_for_isn_and_int8_passing_mismatch (ClusterInfo * cluster );
2021static void check_for_reg_data_type_usage (ClusterInfo * cluster );
2122
@@ -65,6 +66,7 @@ check_old_cluster(bool live_check,
6566 * Check for various failure cases
6667 */
6768check_is_super_user (& old_cluster );
69+ check_for_prepared_transactions (& old_cluster );
6870check_for_reg_data_type_usage (& old_cluster );
6971check_for_isn_and_int8_passing_mismatch (& old_cluster );
7072
@@ -117,6 +119,7 @@ check_new_cluster(void)
117119get_db_and_rel_infos (& new_cluster );
118120
119121check_new_cluster_is_empty ();
122+ check_for_prepared_transactions (& new_cluster );
120123check_old_cluster_has_new_cluster_dbs ();
121124
122125check_loadable_libraries ();
@@ -506,6 +509,36 @@ check_is_super_user(ClusterInfo *cluster)
506509}
507510
508511
512+ /*
513+ *check_for_prepared_transactions()
514+ *
515+ *Make sure there are no prepared transactions because the storage format
516+ *might have changed.
517+ */
518+ static void
519+ check_for_prepared_transactions (ClusterInfo * cluster )
520+ {
521+ PGresult * res ;
522+ PGconn * conn = connectToServer (cluster ,"template1" );
523+
524+ prep_status ("Checking for prepared transactions" );
525+
526+ res = executeQueryOrDie (conn ,
527+ "SELECT * "
528+ "FROM pg_catalog.pg_prepared_xact()" );
529+
530+ if (PQntuples (res )!= 0 )
531+ pg_log (PG_FATAL ,"The %s cluster contains prepared transactions\n" ,
532+ CLUSTER_NAME (cluster ));
533+
534+ PQclear (res );
535+
536+ PQfinish (conn );
537+
538+ check_ok ();
539+ }
540+
541+
509542/*
510543 *check_for_isn_and_int8_passing_mismatch()
511544 *