aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorItagaki Takahiro <itagaki.takahiro@gmail.com>2010-09-28 15:55:25 +0900
committerItagaki Takahiro <itagaki.takahiro@gmail.com>2010-09-28 15:55:25 +0900
commit62b6aaa40b2abb26edf18d1cd00dffcac090f67a (patch)
tree072efebc6580277be8bfcd35f704eed198e8de6b
parentd08c698d9d47f9d004fd0bb6212ca80259e2fe9c (diff)
downloadpostgresql-62b6aaa40b2abb26edf18d1cd00dffcac090f67a.tar.gz
postgresql-62b6aaa40b2abb26edf18d1cd00dffcac090f67a.zip
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.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/src/bin/psql/common.c b/src/bin/psql/common.c
index 7ba2f73c5d0..50e4077343a 100644
--- a/src/bin/psql/common.c
+++ b/src/bin/psql/common.c
@@ -1388,8 +1388,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;
}