Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 62b6aaa

Browse files
committed
Only DISCARD ALL should be in the command_no_begin list.
We allowes DISCARD PLANS and TEMP in a transaction.
1 parent d08c698 commit 62b6aaa

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/bin/psql/common.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1388,8 +1388,20 @@ command_no_begin(const char *query)
13881388
return true;
13891389
}
13901390

1391+
/* DISCARD ALL isn't allowed in xacts, but other variants are allowed. */
13911392
if (wordlen == 7 && pg_strncasecmp(query, "discard", 7) == 0)
1392-
return true;
1393+
{
1394+
query += wordlen;
1395+
1396+
query = skip_white_space(query);
1397+
1398+
wordlen = 0;
1399+
while (isalpha((unsigned char) query[wordlen]))
1400+
wordlen += PQmblen(&query[wordlen], pset.encoding);
1401+
1402+
if (wordlen == 3 && pg_strncasecmp(query, "all", 3) == 0)
1403+
return true;
1404+
}
13931405

13941406
return false;
13951407
}

0 commit comments

Comments
 (0)