]> granicus.if.org Git - postgresql/commitdiff
Fix parsing of DROP SUBSCRIPTION ... DROP SLOT
authorPeter Eisentraut <peter_e@gmx.net>
Sat, 4 Mar 2017 03:14:58 +0000 (22:14 -0500)
committerPeter Eisentraut <peter_e@gmx.net>
Sat, 4 Mar 2017 04:29:13 +0000 (23:29 -0500)
It didn't actually parse before.

Reported-by: Masahiko Sawada <sawada.mshk@gmail.com>
src/backend/parser/gram.y
src/test/subscription/t/001_rep_changes.pl

index 9713b4422324f01b12dd1ab0cfac531d1d12a2ab..29fde33b2b5ccdf93e63980bb4c1fcfcc43ca2fe 100644 (file)
@@ -9196,11 +9196,13 @@ DropSubscriptionStmt: DROP SUBSCRIPTION name opt_drop_slot
                ;
 
 opt_drop_slot:
-                       IDENT SLOT
+                       DROP SLOT
                                {
-                                       if (strcmp($1, "drop") == 0)
-                                               $$ = TRUE;
-                                       else if (strcmp($1, "nodrop") == 0)
+                                       $$ = TRUE;
+                               }
+                       | IDENT SLOT
+                               {
+                                       if (strcmp($1, "nodrop") == 0)
                                                $$ = FALSE;
                                        else
                                                ereport(ERROR,
index fffb3c51bef969336ef5203416bcdcd051258c1c..b81028aed143916ca7af37f9819b4048bd5255fb 100644 (file)
@@ -179,7 +179,7 @@ $node_publisher->poll_query_until('postgres',
   or die "Timed out while waiting for apply to restart";
 
 # check all the cleanup
-$node_subscriber->safe_psql('postgres', "DROP SUBSCRIPTION tap_sub_renamed");
+$node_subscriber->safe_psql('postgres', "DROP SUBSCRIPTION tap_sub_renamed DROP SLOT");
 
 $result =
   $node_subscriber->safe_psql('postgres', "SELECT count(*) FROM pg_subscription");