cast-explicit-hack.patch

text/x-patch

Filename: cast-explicit-hack.patch
Type: text/x-patch
Part: 0
Message: Re: [Review] Re: minor patch submission: CREATE CAST ... AS EXPLICIT

Patch

Same data as JSON: GET /api/v1/attachments/:id/patch the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes. API reference →
Format: unified
File+
src/backend/parser/gram.y 9 2
diff --git a/src/backend/parser/gram.y b/src/backend/parser/gram.y
index 5094226..8021f96 100644
--- a/src/backend/parser/gram.y
+++ b/src/backend/parser/gram.y
@@ -6718,8 +6718,15 @@ CreateCastStmt: CREATE CAST '(' Typename AS Typename ')'
 				}
 		;
 
-cast_context:  AS IMPLICIT_P					{ $$ = COERCION_IMPLICIT; }
-		| AS ASSIGNMENT							{ $$ = COERCION_ASSIGNMENT; }
+cast_context:  AS name
+				{
+					if (pg_strcasecmp($2, "EXPLICIT") == 0)
+						$$ = COERCION_EXPLICIT;
+					else if (pg_strcasecmp($2, "IMPLICIT") == 0)
+						$$ = COERCION_IMPLICIT;
+					else
+						elog(ERROR, "frak!");
+				}
 		| /*EMPTY*/								{ $$ = COERCION_EXPLICIT; }
 		;