v1-0004-Refactor-DROP-LANGUAGE-grammar.patch

text/plain

Filename: v1-0004-Refactor-DROP-LANGUAGE-grammar.patch
Type: text/plain
Part: 3
Message: some grammar refactoring

Patch

Format: format-patch
Series: patch v1-0004
Subject: Refactor DROP LANGUAGE grammar
File+
src/backend/parser/gram.y 2 25
From b4fc3fb474741e73530f4a2a33dc94c511dccaae Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter@eisentraut.org>
Date: Sat, 9 May 2020 11:09:45 +0200
Subject: [PATCH v1 4/6] Refactor DROP LANGUAGE grammar

Fold it into the generic DropStmt.
---
 src/backend/parser/gram.y | 27 ++-------------------------
 1 file changed, 2 insertions(+), 25 deletions(-)

diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 9af37b2c3d..002b3ce01d 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -272,7 +272,7 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
 		CreateAssertionStmt CreateTransformStmt CreateTrigStmt CreateEventTrigStmt
 		CreateUserStmt CreateUserMappingStmt CreateRoleStmt CreatePolicyStmt
 		CreatedbStmt DeclareCursorStmt DefineStmt DeleteStmt DiscardStmt DoStmt
-		DropOpClassStmt DropOpFamilyStmt DropPLangStmt DropStmt
+		DropOpClassStmt DropOpFamilyStmt DropStmt
 		DropCastStmt DropRoleStmt
 		DropdbStmt DropTableSpaceStmt
 		DropTransformStmt
@@ -922,7 +922,6 @@ stmt :
 			| DropOpClassStmt
 			| DropOpFamilyStmt
 			| DropOwnedStmt
-			| DropPLangStmt
 			| DropStmt
 			| DropSubscriptionStmt
 			| DropTableSpaceStmt
@@ -4409,29 +4408,6 @@ opt_validator:
 			| /*EMPTY*/								{ $$ = NIL; }
 		;
 
-DropPLangStmt:
-			DROP opt_procedural LANGUAGE name opt_drop_behavior
-				{
-					DropStmt *n = makeNode(DropStmt);
-					n->removeType = OBJECT_LANGUAGE;
-					n->objects = list_make1(makeString($4));
-					n->behavior = $5;
-					n->missing_ok = false;
-					n->concurrent = false;
-					$$ = (Node *)n;
-				}
-			| DROP opt_procedural LANGUAGE IF_P EXISTS name opt_drop_behavior
-				{
-					DropStmt *n = makeNode(DropStmt);
-					n->removeType = OBJECT_LANGUAGE;
-					n->objects = list_make1(makeString($6));
-					n->behavior = $7;
-					n->missing_ok = true;
-					n->concurrent = false;
-					$$ = (Node *)n;
-				}
-		;
-
 opt_procedural:
 			PROCEDURAL								{}
 			| /*EMPTY*/								{}
@@ -6364,6 +6340,7 @@ drop_type_name:
 			| EVENT TRIGGER							{ $$ = OBJECT_EVENT_TRIGGER; }
 			| EXTENSION								{ $$ = OBJECT_EXTENSION; }
 			| FOREIGN DATA_P WRAPPER				{ $$ = OBJECT_FDW; }
+			| opt_procedural LANGUAGE				{ $$ = OBJECT_LANGUAGE; }
 			| PUBLICATION							{ $$ = OBJECT_PUBLICATION; }
 			| SCHEMA								{ $$ = OBJECT_SCHEMA; }
 			| SERVER								{ $$ = OBJECT_FOREIGN_SERVER; }
-- 
2.26.2