diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-06-17 22:32:51 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-06-17 22:32:51 +0000 |
commit | d0a89683a3a4dd8e76ef0a99101355999e519df5 (patch) | |
tree | b19aaf7f03cbcc851b00ca6e472cc7d3e5a20ca1 /src/bin/psql/common.c | |
parent | 5495575903e35ceb40d32055ab55e9377460208f (diff) |
Two-phase commit. Original patch by Heikki Linnakangas, with additional
hacking by Alvaro Herrera and Tom Lane.
Diffstat (limited to 'src/bin/psql/common.c')
-rw-r--r-- | src/bin/psql/common.c | 17 |
1 files changed, 16 insertions, 1 deletions
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 |