Skip to content

Commit a49ceda

Browse files
committed
Update dummy CREATE ASSERTION grammar
While we are probably still far away from fully implementing assertions, all patch proposals appear to take issue with the existing dummy grammar CREATE/DROP ASSERTION productions, so update those a little bit. Rename the rule, use any_name instead of name, and remove some unused code. Also remove the production for DROP ASSERTION, since that would most likely be handled via the generic DROP support. extracted from a patch by Joe Wildish
1 parent a3d2844 commit a49ceda

File tree

1 file changed

+7
-32
lines changed

1 file changed

+7
-32
lines changed

src/backend/parser/gram.y

Lines changed: 7 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -259,11 +259,11 @@ static Node *makeRecursiveViewSelect(char *relname, List *aliases, Node *query);
259259
CreateOpFamilyStmt AlterOpFamilyStmt CreatePLangStmt
260260
CreateSchemaStmt CreateSeqStmt CreateStmt CreateStatsStmt CreateTableSpaceStmt
261261
CreateFdwStmt CreateForeignServerStmt CreateForeignTableStmt
262-
CreateAssertStmt CreateTransformStmt CreateTrigStmt CreateEventTrigStmt
262+
CreateAssertionStmt CreateTransformStmt CreateTrigStmt CreateEventTrigStmt
263263
CreateUserStmt CreateUserMappingStmt CreateRoleStmt CreatePolicyStmt
264264
CreatedbStmt DeclareCursorStmt DefineStmt DeleteStmt DiscardStmt DoStmt
265265
DropOpClassStmt DropOpFamilyStmt DropPLangStmt DropStmt
266-
DropAssertStmt DropCastStmt DropRoleStmt
266+
DropCastStmt DropRoleStmt
267267
DropdbStmt DropTableSpaceStmt
268268
DropTransformStmt
269269
DropUserMappingStmt ExplainStmt FetchStmt
@@ -860,7 +860,7 @@ stmt :
860860
| CopyStmt
861861
| CreateAmStmt
862862
| CreateAsStmt
863-
| CreateAssertStmt
863+
| CreateAssertionStmt
864864
| CreateCastStmt
865865
| CreateConversionStmt
866866
| CreateDomainStmt
@@ -896,7 +896,6 @@ stmt :
896896
| DeleteStmt
897897
| DiscardStmt
898898
| DoStmt
899-
| DropAssertStmt
900899
| DropCastStmt
901900
| DropOpClassStmt
902901
| DropOpFamilyStmt
@@ -5639,43 +5638,19 @@ enable_trigger:
56395638

56405639
/*****************************************************************************
56415640
*
5642-
* QUERIES :
5641+
* QUERY :
56435642
* CREATE ASSERTION ...
5644-
* DROP ASSERTION ...
56455643
*
56465644
*****************************************************************************/
56475645

5648-
CreateAssertStmt:
5649-
CREATE ASSERTION name CHECK '(' a_expr ')'
5650-
ConstraintAttributeSpec
5646+
CreateAssertionStmt:
5647+
CREATE ASSERTION any_name CHECK '(' a_expr ')' ConstraintAttributeSpec
56515648
{
5652-
CreateTrigStmt *n = makeNode(CreateTrigStmt);
5653-
n->trigname = $3;
5654-
n->args = list_make1($6);
5655-
n->isconstraint = true;
5656-
processCASbits($8, @8, "ASSERTION",
5657-
&n->deferrable, &n->initdeferred, NULL,
5658-
NULL, yyscanner);
5659-
56605649
ereport(ERROR,
56615650
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
56625651
errmsg("CREATE ASSERTION is not yet implemented")));
56635652

5664-
$$ = (Node *)n;
5665-
}
5666-
;
5667-
5668-
DropAssertStmt:
5669-
DROP ASSERTION name opt_drop_behavior
5670-
{
5671-
DropStmt *n = makeNode(DropStmt);
5672-
n->objects = NIL;
5673-
n->behavior = $4;
5674-
n->removeType = OBJECT_TRIGGER; /* XXX */
5675-
ereport(ERROR,
5676-
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
5677-
errmsg("DROP ASSERTION is not yet implemented")));
5678-
$$ = (Node *) n;
5653+
$$ = NULL;
56795654
}
56805655
;
56815656

0 commit comments

Comments
 (0)