diff options
author | Itagaki Takahiro <itagaki.takahiro@gmail.com> | 2010-09-28 15:57:40 +0900 |
---|---|---|
committer | Itagaki Takahiro <itagaki.takahiro@gmail.com> | 2010-09-28 15:57:40 +0900 |
commit | 334ca4fef875097f08b64016b61dad9d97428ae9 (patch) | |
tree | 6dd2daffe64ee92f8dc57f124de301089ec55f7c /src/bin/psql/common.c | |
parent | b4f4d022b07ae162a29f36301a17e12da8011816 (diff) |
Only DISCARD ALL should be in the command_no_begin list.
We allowes DISCARD PLANS and TEMP in a transaction.
Diffstat (limited to 'src/bin/psql/common.c')
-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 0f83dd3c451..64577084a2f 100644 --- a/src/bin/psql/common.c +++ b/src/bin/psql/common.c @@ -1352,8 +1352,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; } |