summaryrefslogtreecommitdiff
path: root/src/bin
diff options
context:
space:
mode:
authorTom Lane2005-06-17 22:32:51 +0000
committerTom Lane2005-06-17 22:32:51 +0000
commitd0a89683a3a4dd8e76ef0a99101355999e519df5 (patch)
treeb19aaf7f03cbcc851b00ca6e472cc7d3e5a20ca1 /src/bin
parent5495575903e35ceb40d32055ab55e9377460208f (diff)
Two-phase commit. Original patch by Heikki Linnakangas, with additional
hacking by Alvaro Herrera and Tom Lane.
Diffstat (limited to 'src/bin')
-rw-r--r--src/bin/initdb/initdb.c3
-rw-r--r--src/bin/psql/common.c17
2 files changed, 18 insertions, 2 deletions
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
index f4951c3f1bb..9e42c902f1c 100644
--- a/src/bin/initdb/initdb.c
+++ b/src/bin/initdb/initdb.c
@@ -39,7 +39,7 @@
* Portions Copyright (c) 1994, Regents of the University of California
* Portions taken from FreeBSD.
*
- * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.83 2005/04/30 08:08:51 neilc Exp $
+ * $PostgreSQL: pgsql/src/bin/initdb/initdb.c,v 1.84 2005/06/17 22:32:47 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -2124,6 +2124,7 @@ main(int argc, char *argv[])
"pg_xlog/archive_status",
"pg_clog",
"pg_subtrans",
+ "pg_twophase",
"pg_multixact/members",
"pg_multixact/offsets",
"base",
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c
index df17d0404bc..fed2275f469 100644
--- a/src/bin/psql/common.c
+++ b/src/bin/psql/common.c
@@ -3,7 +3,7 @@
*
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
*
- * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.102 2005/06/14 02:57:41 momjian Exp $
+ * $PostgreSQL: pgsql/src/bin/psql/common.c,v 1.103 2005/06/17 22:32:47 tgl Exp $
*/
#include "postgres_fe.h"
#include "common.h"
@@ -1216,6 +1216,21 @@ command_no_begin(const char *query)
return true;
if (wordlen == 8 && pg_strncasecmp(query, "rollback", 8) == 0)
return true;
+ if (wordlen == 7 && pg_strncasecmp(query, "prepare", 7) == 0)
+ {
+ /* PREPARE TRANSACTION is a TC command, PREPARE foo is not */
+ query += wordlen;
+
+ query = skip_white_space(query);
+
+ wordlen = 0;
+ while (isalpha((unsigned char) query[wordlen]))
+ wordlen += PQmblen(&query[wordlen], pset.encoding);
+
+ if (wordlen == 11 && pg_strncasecmp(query, "transaction", 11) == 0)
+ return true;
+ return false;
+ }
/*
* Commands not allowed within transactions. The statements checked