@@ -170,6 +170,9 @@ ddl_statement_postgres
170170 / drop_role_stmt
171171 / set_role_stmt
172172 / reset_role_stmt
173+ / create_policy_stmt
174+ / alter_policy_stmt
175+ / drop_policy_stmt
173176
174177dml_statement
175178 = compound_select_stmt
@@ -4636,6 +4639,103 @@ reset_role_stmt
46364639 return loc ({ type: " reset_role_stmt" , resetRoleKw: read (kw) });
46374640 }
46384641
4642+ /**
4643+ * ------------------------------------------------------------------------------------ *
4644+ * *
4645+ * CREATE/ALTER/DROP POLICY *
4646+ * *
4647+ * ------------------------------------------------------------------------------------ *
4648+ */
4649+ create_policy_stmt
4650+ = kw :(CREATE __ POLICY __ ) name :(ident __ ) onKw :(ON __ ) table :entity_name
4651+ clauses :(__ create_policy_clause )* {
4652+ return loc ({
4653+ type: " create_policy_stmt" ,
4654+ createPolicyKw: read (kw),
4655+ name: read (name),
4656+ onKw: read (onKw),
4657+ table,
4658+ clauses: clauses .map (read),
4659+ });
4660+ }
4661+
4662+ create_policy_clause
4663+ = policy_permissive_clause
4664+ / policy_restrictive_clause
4665+ / policy_command_clause
4666+ / policy_roles_clause
4667+ / policy_using_clause
4668+ / policy_check_clause
4669+
4670+ policy_permissive_clause
4671+ = asKw :(AS __ ) permissiveKw :PERMISSIVE {
4672+ return loc ({
4673+ type: " policy_permissive_clause" ,
4674+ asKw: read (asKw),
4675+ permissiveKw,
4676+ });
4677+ }
4678+
4679+ policy_restrictive_clause
4680+ = asKw :(AS __ ) restrictiveKw :RESTRICTIVE {
4681+ return loc ({
4682+ type: " policy_restrictive_clause" ,
4683+ asKw: read (asKw),
4684+ restrictiveKw,
4685+ });
4686+ }
4687+
4688+ policy_command_clause
4689+ = kw :(FOR __ ) commandKw :(ALL / SELECT / INSERT / UPDATE / DELETE ) {
4690+ return loc ({ type: " policy_command_clause" , forKw: read (kw), commandKw });
4691+ }
4692+
4693+ policy_roles_clause
4694+ = kw :(TO __ ) roles :list$grantee {
4695+ return loc ({ type: " policy_roles_clause" , toKw: read (kw), roles });
4696+ }
4697+
4698+ policy_using_clause
4699+ = kw :(USING __ ) expr :paren$expr {
4700+ return loc ({ type: " policy_using_clause" , usingKw: read (kw), expr });
4701+ }
4702+
4703+ policy_check_clause
4704+ = withKw :(WITH __ ) checkKw :(CHECK __ ) expr :paren$expr {
4705+ return loc ({ type: " policy_check_clause" , withKw: read (withKw), checkKw: read (checkKw), expr });
4706+ }
4707+
4708+ alter_policy_stmt
4709+ = kw :(ALTER __ POLICY __ ) name :(ident __ ) onKw :(ON __ ) table :entity_name actions :(__ alter_policy_action )+ {
4710+ return loc ({
4711+ type: " alter_policy_stmt" ,
4712+ alterPolicyKw: read (kw),
4713+ name: read (name),
4714+ onKw: read (onKw),
4715+ table,
4716+ actions: actions .map (read),
4717+ });
4718+ }
4719+
4720+ alter_policy_action
4721+ = alter_action_rename
4722+ / policy_roles_clause
4723+ / policy_using_clause
4724+ / policy_check_clause
4725+
4726+ drop_policy_stmt
4727+ = kw :(DROP __ POLICY __ ) ifExistsKw :(if_exists __ )? name :(ident __ ) onKw :(ON __ ) table :entity_name behaviorKw :(__ (CASCADE / RESTRICT ))? {
4728+ return loc ({
4729+ type: " drop_policy_stmt" ,
4730+ dropPolicyKw: read (kw),
4731+ ifExistsKw: read (ifExistsKw),
4732+ name: read (name),
4733+ onKw: read (onKw),
4734+ table,
4735+ behaviorKw: read (behaviorKw),
4736+ });
4737+ }
4738+
46394739/**
46404740 * ------------------------------------------------------------------------------------ *
46414741 * *
@@ -9010,6 +9110,7 @@ PARTITION = kw:"PARTITION"i !ident_part { return loc(createK
90109110PASSWORD = kw :"PASSWORD" i ! ident_part { return loc (createKeyword (kw)); }
90119111PERCENT = kw :"PERCENT" i ! ident_part { return loc (createKeyword (kw)); }
90129112PERCENT_RANK = kw :"PERCENT_RANK" i ! ident_part { return loc (createKeyword (kw)); }
9113+ PERMISSIVE = kw :"PERMISSIVE" i ! ident_part { return loc (createKeyword (kw)); }
90139114PERSIST = kw :"PERSIST" i ! ident_part { return loc (createKeyword (kw)); }
90149115PERSIST_ONLY = kw :"PERSIST_ONLY" i ! ident_part { return loc (createKeyword (kw)); }
90159116PIVOT = kw :"PIVOT" i ! ident_part { return loc (createKeyword (kw)); }
@@ -9058,6 +9159,7 @@ RESPECT = kw:"RESPECT"i !ident_part { return loc(createK
90589159RESTART = kw :"RESTART" i ! ident_part { return loc (createKeyword (kw)); }
90599160RESTRICT = kw :"RESTRICT" i ! ident_part { return loc (createKeyword (kw)); }
90609161RESTRICTED = kw :"RESTRICTED" i ! ident_part { return loc (createKeyword (kw)); }
9162+ RESTRICTIVE = kw :"RESTRICTIVE" i ! ident_part { return loc (createKeyword (kw)); }
90619163RETURN = kw :"RETURN" i ! ident_part { return loc (createKeyword (kw)); }
90629164RETURNING = kw :"RETURNING" i ! ident_part { return loc (createKeyword (kw)); }
90639165RETURNS = kw :"RETURNS" i ! ident_part { return loc (createKeyword (kw)); }
0 commit comments