diff options
author | Itagaki Takahiro | 2010-09-28 06:57:19 +0000 |
---|---|---|
committer | Itagaki Takahiro | 2010-09-28 06:57:19 +0000 |
commit | 2dc2ea81f67b96473cefe8fc7d515bda37255660 (patch) | |
tree | 842db2009a7c16ce98f2e5b1d87fcccf61a4622d | |
parent | b66c4fb322b21a57c0b05cd3bd89c49def654eae (diff) |
Only DISCARD ALL should be in the command_no_begin list.
We allowes DISCARD PLANS and TEMP in a transaction.
-rw-r--r-- | src/bin/psql/common.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c index c8fc085fa04..81a633a3d01 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1369,8 +1369,20 @@ command_no_begin(const char *query) return true; } + /* DISCARD ALL isn't allowed in xacts, but other variants are allowed. */ if (wordlen == 7 && pg_strncasecmp(query, "discard", 7) == 0) - return true; + { + query += wordlen; + + query = skip_white_space(query); + + wordlen = 0; + while (isalpha((unsigned char) query[wordlen])) + wordlen += PQmblen(&query[wordlen], pset.encoding); + + if (wordlen == 3 && pg_strncasecmp(query, "all", 3) == 0) + return true; + } return false; } |