From d0a89683a3a4dd8e76ef0a99101355999e519df5 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Fri, 17 Jun 2005 22:32:51 +0000 Subject: Two-phase commit. Original patch by Heikki Linnakangas, with additional hacking by Alvaro Herrera and Tom Lane. --- src/bin/psql/common.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/bin/psql/common.c') diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index df17d0404b..fed2275f46 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 -- cgit v1.2.1