1use crate::*;
2
3pub use protobuf::node::Node as NodeEnum;
4
5#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
6pub enum Context {
7 None,
8 Select,
9 DML,
10 DDL,
11 Call,
12}
13
14impl NodeEnum {
15 pub fn deparse(&self) -> Result<String> {
16 crate::deparse(&protobuf::ParseResult {
17 version: crate::bindings::PG_VERSION_NUM as i32,
18 stmts: vec![protobuf::RawStmt { stmt: Some(Box::new(Node { node: Some(self.clone()) })), stmt_location: 0, stmt_len: 0 }],
19 })
20 }
21
22 pub fn nodes(&self) -> Vec<(NodeRef, i32, Context, bool)> {
23 let mut iter = vec![(self.to_ref(), 0, Context::None, false)];
24 let mut nodes = Vec::new();
25 while !iter.is_empty() {
26 let (node, depth, context, has_filter_columns) = iter.remove(0);
27 let depth = depth + 1;
28 match node {
29 NodeRef::SelectStmt(s) => {
33 s.target_list.iter().for_each(|n| {
34 if let Some(n) = n.node.as_ref() {
35 iter.push((n.to_ref(), depth, Context::Select, false));
36 }
37 });
38 if let Some(n) = &s.where_clause {
39 if let Some(n) = n.node.as_ref() {
40 iter.push((n.to_ref(), depth, Context::Select, true));
41 }
42 }
43 s.sort_clause.iter().for_each(|n| {
44 if let Some(n) = n.node.as_ref() {
45 iter.push((n.to_ref(), depth, Context::Select, false));
46 }
47 });
48 s.group_clause.iter().for_each(|n| {
49 if let Some(n) = n.node.as_ref() {
50 iter.push((n.to_ref(), depth, Context::Select, false));
51 }
52 });
53 if let Some(n) = &s.having_clause {
54 if let Some(n) = n.node.as_ref() {
55 iter.push((n.to_ref(), depth, Context::Select, false));
56 }
57 }
58 if let Some(clause) = &s.with_clause {
59 clause.ctes.iter().for_each(|n| {
60 if let Some(n) = n.node.as_ref() {
61 iter.push((n.to_ref(), depth, Context::Select, false));
62 }
63 });
64 }
65 match protobuf::SetOperation::try_from(s.op) {
66 Ok(protobuf::SetOperation::SetopNone) => {
67 s.from_clause.iter().for_each(|n| {
68 if let Some(n) = n.node.as_ref() {
69 iter.push((n.to_ref(), depth, Context::Select, false));
70 }
71 });
72 }
73 Ok(protobuf::SetOperation::SetopUnion) => {
74 if let Some(left) = s.larg.as_ref() {
75 iter.push((left.to_ref(), depth, Context::Select, false));
76 }
77 if let Some(right) = s.rarg.as_ref() {
78 iter.push((right.to_ref(), depth, Context::Select, false));
79 }
80 }
81 Ok(protobuf::SetOperation::SetopExcept) => {
82 if let Some(left) = s.larg.as_ref() {
83 iter.push((left.to_ref(), depth, Context::Select, false));
84 }
85 if let Some(right) = s.rarg.as_ref() {
86 iter.push((right.to_ref(), depth, Context::Select, false));
87 }
88 }
89 Ok(protobuf::SetOperation::SetopIntersect) => {
90 if let Some(left) = s.larg.as_ref() {
91 iter.push((left.to_ref(), depth, Context::Select, false));
92 }
93 if let Some(right) = s.rarg.as_ref() {
94 iter.push((right.to_ref(), depth, Context::Select, false));
95 }
96 }
97 Ok(protobuf::SetOperation::Undefined) | Err(_) => (),
98 }
99 }
100 NodeRef::InsertStmt(s) => {
101 if let Some(n) = &s.select_stmt {
102 if let Some(n) = n.node.as_ref() {
103 iter.push((n.to_ref(), depth, Context::DML, false));
104 }
105 }
106 if let Some(rel) = s.relation.as_ref() {
107 iter.push((rel.to_ref(), depth, Context::DML, false));
108 }
109 if let Some(clause) = &s.with_clause {
110 clause.ctes.iter().for_each(|n| {
111 if let Some(n) = n.node.as_ref() {
112 iter.push((n.to_ref(), depth, Context::DML, false));
113 }
114 });
115 }
116 if let Some(n) = &s.on_conflict_clause {
117 iter.push((n.to_ref(), depth, Context::DML, false));
118 }
119 }
120 NodeRef::UpdateStmt(s) => {
121 s.target_list.iter().for_each(|n| {
122 if let Some(n) = n.node.as_ref() {
123 iter.push((n.to_ref(), depth, Context::DML, false));
124 }
125 });
126 s.where_clause.iter().for_each(|n| {
127 if let Some(n) = n.node.as_ref() {
128 iter.push((n.to_ref(), depth, Context::DML, true));
129 }
130 });
131 s.from_clause.iter().for_each(|n| {
132 if let Some(n) = n.node.as_ref() {
133 iter.push((n.to_ref(), depth, Context::Select, false));
134 }
135 });
136 if let Some(rel) = s.relation.as_ref() {
137 iter.push((rel.to_ref(), depth, Context::DML, false));
138 }
139 if let Some(clause) = &s.with_clause {
140 clause.ctes.iter().for_each(|n| {
141 if let Some(n) = n.node.as_ref() {
142 iter.push((n.to_ref(), depth, Context::DML, false));
143 }
144 });
145 }
146 }
147 NodeRef::DeleteStmt(s) => {
148 if let Some(n) = &s.where_clause {
149 if let Some(n) = n.node.as_ref() {
150 iter.push((n.to_ref(), depth, Context::DML, true));
151 }
152 }
153 if let Some(rel) = s.relation.as_ref() {
154 iter.push((rel.to_ref(), depth, Context::DML, false));
155 }
156 if let Some(clause) = &s.with_clause {
157 clause.ctes.iter().for_each(|n| {
158 if let Some(n) = n.node.as_ref() {
159 iter.push((n.to_ref(), depth, Context::DML, false));
160 }
161 });
162 }
163 s.using_clause.iter().for_each(|n| {
164 if let Some(n) = n.node.as_ref() {
165 iter.push((n.to_ref(), depth, Context::Select, false));
166 }
167 });
168 }
169 NodeRef::CommonTableExpr(s) => {
170 if let Some(n) = &s.ctequery {
171 if let Some(n) = n.node.as_ref() {
172 iter.push((n.to_ref(), depth, context, false));
173 }
174 }
175 }
176 NodeRef::CopyStmt(s) => {
177 if let Some(n) = &s.query {
178 if let Some(n) = n.node.as_ref() {
179 iter.push((n.to_ref(), depth, Context::DML, false));
180 }
181 }
182 if let Some(rel) = s.relation.as_ref() {
183 iter.push((rel.to_ref(), depth, Context::DML, false));
184 }
185 }
186 NodeRef::AlterTableStmt(s) => {
190 if let Some(rel) = s.relation.as_ref() {
191 iter.push((rel.to_ref(), depth, Context::DDL, false));
192 }
193 }
194 NodeRef::CreateStmt(s) => {
195 if let Some(rel) = s.relation.as_ref() {
196 iter.push((rel.to_ref(), depth, Context::DDL, false));
197 }
198 }
199 NodeRef::CreateTableAsStmt(s) => {
200 if let Some(n) = &s.query {
201 if let Some(n) = n.node.as_ref() {
202 iter.push((n.to_ref(), depth, Context::DDL, false));
203 }
204 }
205 if let Some(n) = &s.into {
206 if let Some(rel) = n.rel.as_ref() {
207 iter.push((rel.to_ref(), depth, Context::DDL, false));
208 }
209 }
210 }
211 NodeRef::TruncateStmt(s) => {
212 s.relations.iter().for_each(|n| {
213 if let Some(n) = n.node.as_ref() {
214 iter.push((n.to_ref(), depth, Context::DDL, false));
215 }
216 });
217 }
218 NodeRef::ViewStmt(s) => {
219 if let Some(n) = &s.query {
220 if let Some(n) = n.node.as_ref() {
221 iter.push((n.to_ref(), depth, Context::DDL, false));
222 }
223 }
224 if let Some(rel) = s.view.as_ref() {
225 iter.push((rel.to_ref(), depth, Context::DDL, false));
226 }
227 }
228 NodeRef::IndexStmt(s) => {
229 if let Some(rel) = s.relation.as_ref() {
230 iter.push((rel.to_ref(), depth, Context::DDL, false));
231 }
232 s.index_params.iter().for_each(|n| {
233 if let Some(NodeEnum::IndexElem(n)) = n.node.as_ref() {
234 if let Some(n) = n.expr.as_ref().and_then(|n| n.node.as_ref()) {
235 iter.push((n.to_ref(), depth, Context::DDL, false));
236 }
237 }
238 });
239 if let Some(n) = s.where_clause.as_ref() {
240 if let Some(n) = n.node.as_ref() {
241 iter.push((n.to_ref(), depth, Context::DDL, true));
242 }
243 }
244 }
245 NodeRef::CreateTrigStmt(s) => {
246 if let Some(rel) = s.relation.as_ref() {
247 iter.push((rel.to_ref(), depth, Context::DDL, false));
248 }
249 }
250 NodeRef::RuleStmt(s) => {
251 if let Some(rel) = s.relation.as_ref() {
252 iter.push((rel.to_ref(), depth, Context::DDL, false));
253 }
254 }
255 NodeRef::VacuumStmt(s) => {
256 for node in &s.rels {
257 if let Some(NodeEnum::VacuumRelation(r)) = &node.node {
258 if let Some(rel) = r.relation.as_ref() {
259 iter.push((rel.to_ref(), depth, Context::DDL, false));
260 }
261 }
262 }
263 }
264 NodeRef::RefreshMatViewStmt(s) => {
265 if let Some(rel) = s.relation.as_ref() {
266 iter.push((rel.to_ref(), depth, Context::DDL, false));
267 }
268 }
269 NodeRef::GrantStmt(s) => {
270 if let Ok(protobuf::ObjectType::ObjectTable) = protobuf::ObjectType::try_from(s.objtype) {
271 s.objects.iter().for_each(|n| {
272 if let Some(n) = n.node.as_ref() {
273 iter.push((n.to_ref(), depth, Context::DDL, false));
274 }
275 });
276 }
277 }
278 NodeRef::LockStmt(s) => {
279 s.relations.iter().for_each(|n| {
280 if let Some(n) = n.node.as_ref() {
281 iter.push((n.to_ref(), depth, Context::DDL, false));
282 }
283 });
284 }
285 NodeRef::ExplainStmt(s) => {
286 if let Some(n) = &s.query {
287 if let Some(n) = n.node.as_ref() {
288 iter.push((n.to_ref(), depth, context, false));
289 }
290 }
291 }
292 NodeRef::AExpr(e) => {
296 if let Some(n) = &e.lexpr {
297 if let Some(n) = n.node.as_ref() {
298 iter.push((n.to_ref(), depth, context, has_filter_columns));
299 }
300 }
301 if let Some(n) = &e.rexpr {
302 if let Some(n) = n.node.as_ref() {
303 iter.push((n.to_ref(), depth, context, has_filter_columns));
304 }
305 }
306 }
307 NodeRef::BoolExpr(e) => {
308 e.args.iter().for_each(|n| {
309 if let Some(n) = n.node.as_ref() {
310 iter.push((n.to_ref(), depth, context, has_filter_columns));
311 }
312 });
313 }
314 NodeRef::BooleanTest(e) => {
315 if let Some(n) = &e.arg {
316 if let Some(n) = n.node.as_ref() {
317 iter.push((n.to_ref(), depth, context, has_filter_columns));
318 }
319 }
320 }
321 NodeRef::CoalesceExpr(e) => {
322 e.args.iter().for_each(|n| {
323 if let Some(n) = n.node.as_ref() {
324 iter.push((n.to_ref(), depth, context, has_filter_columns));
325 }
326 });
327 }
328 NodeRef::MinMaxExpr(e) => {
329 e.args.iter().for_each(|n| {
330 if let Some(n) = n.node.as_ref() {
331 iter.push((n.to_ref(), depth, context, has_filter_columns));
332 }
333 });
334 }
335 NodeRef::NullTest(e) => {
336 if let Some(n) = &e.arg {
337 if let Some(n) = n.node.as_ref() {
338 iter.push((n.to_ref(), depth, context, has_filter_columns));
339 }
340 }
341 }
342 NodeRef::ResTarget(t) => {
343 if let Some(n) = &t.val {
344 if let Some(n) = n.node.as_ref() {
345 iter.push((n.to_ref(), depth, context, has_filter_columns));
346 }
347 }
348 }
349 NodeRef::SubLink(l) => {
350 if let Some(n) = &l.subselect {
351 if let Some(n) = n.node.as_ref() {
352 iter.push((n.to_ref(), depth, context, has_filter_columns));
353 }
354 }
355 }
356 NodeRef::FuncCall(c) => {
357 c.args.iter().for_each(|n| {
358 if let Some(n) = n.node.as_ref() {
359 iter.push((n.to_ref(), depth, context, has_filter_columns));
360 }
361 });
362 }
363 NodeRef::CaseExpr(c) => {
364 c.args.iter().for_each(|n| {
365 if let Some(n) = n.node.as_ref() {
366 iter.push((n.to_ref(), depth, context, has_filter_columns));
367 }
368 });
369 if let Some(n) = &c.defresult {
370 if let Some(n) = n.node.as_ref() {
371 iter.push((n.to_ref(), depth, context, has_filter_columns));
372 }
373 }
374 }
375 NodeRef::CaseWhen(w) => {
376 if let Some(n) = &w.expr {
377 if let Some(n) = n.node.as_ref() {
378 iter.push((n.to_ref(), depth, context, has_filter_columns));
379 }
380 }
381 if let Some(n) = &w.result {
382 if let Some(n) = n.node.as_ref() {
383 iter.push((n.to_ref(), depth, context, has_filter_columns));
384 }
385 }
386 }
387 NodeRef::SortBy(n) => {
388 if let Some(n) = &n.node {
389 if let Some(n) = n.node.as_ref() {
390 iter.push((n.to_ref(), depth, context, has_filter_columns));
391 }
392 }
393 }
394 NodeRef::TypeCast(n) => {
395 if let Some(n) = &n.arg {
396 if let Some(n) = n.node.as_ref() {
397 iter.push((n.to_ref(), depth, context, has_filter_columns));
398 }
399 }
400 }
401 NodeRef::List(l) => {
405 l.items.iter().for_each(|n| {
406 if let Some(n) = n.node.as_ref() {
407 iter.push((n.to_ref(), depth, context, has_filter_columns));
408 }
409 });
410 }
411 NodeRef::JoinExpr(e) => {
412 [&e.larg, &e.rarg, &e.quals].iter().for_each(|n| {
413 if let Some(n) = n {
414 if let Some(n) = n.node.as_ref() {
415 iter.push((n.to_ref(), depth, context, has_filter_columns));
416 }
417 }
418 });
419 }
420 NodeRef::RowExpr(e) => {
421 e.args.iter().for_each(|n| {
422 if let Some(n) = n.node.as_ref() {
423 iter.push((n.to_ref(), depth, context, has_filter_columns));
424 }
425 });
426 }
427 NodeRef::RangeSubselect(s) => {
428 if let Some(n) = &s.subquery {
429 if let Some(n) = n.node.as_ref() {
430 iter.push((n.to_ref(), depth, context, has_filter_columns));
431 }
432 }
433 }
434 NodeRef::RangeFunction(f) => {
435 f.functions.iter().for_each(|n| {
436 if let Some(n) = n.node.as_ref() {
437 iter.push((n.to_ref(), depth, context, has_filter_columns));
438 }
439 });
440 }
441 _ => (),
442 }
443 nodes.push((node, depth, context, has_filter_columns));
444 }
445 nodes
446 }
447
448 pub unsafe fn nodes_mut(&mut self) -> Vec<(NodeMut, i32, Context)> {
455 let mut iter = vec![(self.to_mut(), 0, Context::None)];
456 let mut nodes = Vec::new();
457 while !iter.is_empty() {
458 let (node, depth, context) = iter.remove(0);
459 let depth = depth + 1;
460 match node {
461 NodeMut::SelectStmt(s) => {
465 let s = s.as_mut().unwrap();
466 s.target_list.iter_mut().for_each(|n| {
467 if let Some(n) = n.node.as_mut() {
468 iter.push((n.to_mut(), depth, Context::Select));
469 }
470 });
471 if let Some(n) = s.where_clause.as_mut() {
472 if let Some(n) = n.node.as_mut() {
473 iter.push((n.to_mut(), depth, Context::Select));
474 }
475 }
476 s.sort_clause.iter_mut().for_each(|n| {
477 if let Some(n) = n.node.as_mut() {
478 iter.push((n.to_mut(), depth, Context::Select));
479 }
480 });
481 s.group_clause.iter_mut().for_each(|n| {
482 if let Some(n) = n.node.as_mut() {
483 iter.push((n.to_mut(), depth, Context::Select));
484 }
485 });
486 if let Some(n) = s.having_clause.as_mut() {
487 if let Some(n) = n.node.as_mut() {
488 iter.push((n.to_mut(), depth, Context::Select));
489 }
490 }
491 if let Some(clause) = s.with_clause.as_mut() {
492 clause.ctes.iter_mut().for_each(|n| {
493 if let Some(n) = n.node.as_mut() {
494 iter.push((n.to_mut(), depth, Context::Select));
495 }
496 });
497 }
498 match protobuf::SetOperation::try_from(s.op) {
499 Ok(protobuf::SetOperation::SetopNone) => {
500 s.from_clause.iter_mut().for_each(|n| {
501 if let Some(n) = n.node.as_mut() {
502 iter.push((n.to_mut(), depth, Context::Select));
503 }
504 });
505 }
506 Ok(protobuf::SetOperation::SetopUnion) => {
507 if let Some(left) = s.larg.as_mut() {
508 iter.push((left.to_mut(), depth, Context::Select));
509 }
510 if let Some(right) = s.rarg.as_mut() {
511 iter.push((right.to_mut(), depth, Context::Select));
512 }
513 }
514 Ok(protobuf::SetOperation::SetopExcept) => {
515 if let Some(left) = s.larg.as_mut() {
516 iter.push((left.to_mut(), depth, Context::Select));
517 }
518 if let Some(right) = s.rarg.as_mut() {
519 iter.push((right.to_mut(), depth, Context::Select));
520 }
521 }
522 Ok(protobuf::SetOperation::SetopIntersect) => {
523 if let Some(left) = s.larg.as_mut() {
524 iter.push((left.to_mut(), depth, Context::Select));
525 }
526 if let Some(right) = s.rarg.as_mut() {
527 iter.push((right.to_mut(), depth, Context::Select));
528 }
529 }
530 Ok(protobuf::SetOperation::Undefined) | Err(_) => (),
531 }
532 }
533 NodeMut::InsertStmt(s) => {
534 let s = s.as_mut().unwrap();
535 if let Some(n) = s.select_stmt.as_mut() {
536 if let Some(n) = n.node.as_mut() {
537 iter.push((n.to_mut(), depth, Context::DML));
538 }
539 }
540 if let Some(rel) = s.relation.as_mut() {
541 iter.push((rel.to_mut(), depth, Context::DML));
542 }
543 if let Some(clause) = s.with_clause.as_mut() {
544 clause.ctes.iter_mut().for_each(|n| {
545 if let Some(n) = n.node.as_mut() {
546 iter.push((n.to_mut(), depth, Context::DML));
547 }
548 });
549 }
550 if let Some(n) = s.on_conflict_clause.as_mut() {
551 iter.push((n.to_mut(), depth, Context::DML));
552 }
553 }
554 NodeMut::UpdateStmt(s) => {
555 let s = s.as_mut().unwrap();
556 s.target_list.iter_mut().for_each(|n| {
557 if let Some(n) = n.node.as_mut() {
558 iter.push((n.to_mut(), depth, Context::DML));
559 }
560 });
561 s.where_clause.iter_mut().for_each(|n| {
562 if let Some(n) = n.node.as_mut() {
563 iter.push((n.to_mut(), depth, Context::DML));
564 }
565 });
566 s.from_clause.iter_mut().for_each(|n| {
567 if let Some(n) = n.node.as_mut() {
568 iter.push((n.to_mut(), depth, Context::Select));
569 }
570 });
571 if let Some(rel) = s.relation.as_mut() {
572 iter.push((rel.to_mut(), depth, Context::DML));
573 }
574 if let Some(clause) = s.with_clause.as_mut() {
575 clause.ctes.iter_mut().for_each(|n| {
576 if let Some(n) = n.node.as_mut() {
577 iter.push((n.to_mut(), depth, Context::DML));
578 }
579 });
580 }
581 }
582 NodeMut::DeleteStmt(s) => {
583 let s = s.as_mut().unwrap();
584 if let Some(n) = s.where_clause.as_mut() {
585 if let Some(n) = n.node.as_mut() {
586 iter.push((n.to_mut(), depth, Context::DML));
587 }
588 }
589 if let Some(rel) = s.relation.as_mut() {
590 iter.push((rel.to_mut(), depth, Context::DML));
591 }
592 if let Some(clause) = s.with_clause.as_mut() {
593 clause.ctes.iter_mut().for_each(|n| {
594 if let Some(n) = n.node.as_mut() {
595 iter.push((n.to_mut(), depth, Context::DML));
596 }
597 });
598 }
599 s.using_clause.iter_mut().for_each(|n| {
600 if let Some(n) = n.node.as_mut() {
601 iter.push((n.to_mut(), depth, Context::Select));
602 }
603 });
604 }
605 NodeMut::CommonTableExpr(s) => {
606 let s = s.as_mut().unwrap();
607 if let Some(n) = s.ctequery.as_mut() {
608 if let Some(n) = n.node.as_mut() {
609 iter.push((n.to_mut(), depth, context));
610 }
611 }
612 }
613 NodeMut::CopyStmt(s) => {
614 let s = s.as_mut().unwrap();
615 if let Some(n) = s.query.as_mut() {
616 if let Some(n) = n.node.as_mut() {
617 iter.push((n.to_mut(), depth, Context::DML));
618 }
619 }
620 if let Some(rel) = s.relation.as_mut() {
621 iter.push((rel.to_mut(), depth, Context::DML));
622 }
623 }
624 NodeMut::AlterTableStmt(s) => {
628 let s = s.as_mut().unwrap();
629 if let Some(rel) = s.relation.as_mut() {
630 iter.push((rel.to_mut(), depth, Context::DDL));
631 }
632 }
633 NodeMut::CreateStmt(s) => {
634 let s = s.as_mut().unwrap();
635 if let Some(rel) = s.relation.as_mut() {
636 iter.push((rel.to_mut(), depth, Context::DDL));
637 }
638 }
639 NodeMut::CreateTableAsStmt(s) => {
640 let s = s.as_mut().unwrap();
641 if let Some(n) = s.query.as_mut() {
642 if let Some(n) = n.node.as_mut() {
643 iter.push((n.to_mut(), depth, Context::DDL));
644 }
645 }
646 if let Some(n) = s.into.as_mut() {
647 if let Some(rel) = n.rel.as_mut() {
648 iter.push((rel.to_mut(), depth, Context::DDL));
649 }
650 }
651 }
652 NodeMut::TruncateStmt(s) => {
653 let s = s.as_mut().unwrap();
654 s.relations.iter_mut().for_each(|n| {
655 if let Some(n) = n.node.as_mut() {
656 iter.push((n.to_mut(), depth, Context::DDL));
657 }
658 });
659 }
660 NodeMut::ViewStmt(s) => {
661 let s = s.as_mut().unwrap();
662 if let Some(n) = s.query.as_mut() {
663 if let Some(n) = n.node.as_mut() {
664 iter.push((n.to_mut(), depth, Context::DDL));
665 }
666 }
667 if let Some(rel) = s.view.as_mut() {
668 iter.push((rel.to_mut(), depth, Context::DDL));
669 }
670 }
671 NodeMut::IndexStmt(s) => {
672 let s = s.as_mut().unwrap();
673 if let Some(rel) = s.relation.as_mut() {
674 iter.push((rel.to_mut(), depth, Context::DDL));
675 }
676 s.index_params.iter_mut().for_each(|n| {
677 if let Some(NodeEnum::IndexElem(n)) = n.node.as_mut() {
678 if let Some(n) = n.expr.as_mut().and_then(|n| n.node.as_mut()) {
679 iter.push((n.to_mut(), depth, Context::DDL));
680 }
681 }
682 });
683 }
684 NodeMut::CreateTrigStmt(s) => {
685 let s = s.as_mut().unwrap();
686 if let Some(rel) = s.relation.as_mut() {
687 iter.push((rel.to_mut(), depth, Context::DDL));
688 }
689 }
690 NodeMut::RuleStmt(s) => {
691 let s = s.as_mut().unwrap();
692 if let Some(rel) = s.relation.as_mut() {
693 iter.push((rel.to_mut(), depth, Context::DDL));
694 }
695 }
696 NodeMut::VacuumStmt(s) => {
697 let s = s.as_mut().unwrap();
698 for node in s.rels.iter_mut() {
699 if let Some(NodeEnum::VacuumRelation(r)) = node.node.as_mut() {
700 if let Some(rel) = r.relation.as_mut() {
701 iter.push((rel.to_mut(), depth, Context::DDL));
702 }
703 }
704 }
705 }
706 NodeMut::RefreshMatViewStmt(s) => {
707 let s = s.as_mut().unwrap();
708 if let Some(rel) = s.relation.as_mut() {
709 iter.push((rel.to_mut(), depth, Context::DDL));
710 }
711 }
712 NodeMut::GrantStmt(s) => {
713 let s = s.as_mut().unwrap();
714 if let Ok(protobuf::ObjectType::ObjectTable) = protobuf::ObjectType::try_from(s.objtype) {
715 s.objects.iter_mut().for_each(|n| {
716 if let Some(n) = n.node.as_mut() {
717 iter.push((n.to_mut(), depth, Context::DDL));
718 }
719 });
720 }
721 }
722 NodeMut::LockStmt(s) => {
723 let s = s.as_mut().unwrap();
724 s.relations.iter_mut().for_each(|n| {
725 if let Some(n) = n.node.as_mut() {
726 iter.push((n.to_mut(), depth, Context::DDL));
727 }
728 });
729 }
730 NodeMut::ExplainStmt(s) => {
731 let s = s.as_mut().unwrap();
732 if let Some(n) = s.query.as_mut() {
733 if let Some(n) = n.node.as_mut() {
734 iter.push((n.to_mut(), depth, context));
735 }
736 }
737 }
738 NodeMut::AExpr(e) => {
742 let e = e.as_mut().unwrap();
743 if let Some(n) = e.lexpr.as_mut() {
744 if let Some(n) = n.node.as_mut() {
745 iter.push((n.to_mut(), depth, context));
746 }
747 }
748 if let Some(n) = e.rexpr.as_mut() {
749 if let Some(n) = n.node.as_mut() {
750 iter.push((n.to_mut(), depth, context));
751 }
752 }
753 }
754 NodeMut::BoolExpr(e) => {
755 let e = e.as_mut().unwrap();
756 e.args.iter_mut().for_each(|n| {
757 if let Some(n) = n.node.as_mut() {
758 iter.push((n.to_mut(), depth, context));
759 }
760 });
761 }
762 NodeMut::CoalesceExpr(e) => {
763 let e = e.as_mut().unwrap();
764 e.args.iter_mut().for_each(|n| {
765 if let Some(n) = n.node.as_mut() {
766 iter.push((n.to_mut(), depth, context));
767 }
768 });
769 }
770 NodeMut::MinMaxExpr(e) => {
771 let e = e.as_mut().unwrap();
772 e.args.iter_mut().for_each(|n| {
773 if let Some(n) = n.node.as_mut() {
774 iter.push((n.to_mut(), depth, context));
775 }
776 });
777 }
778 NodeMut::NullTest(e) => {
779 let e = e.as_mut().unwrap();
780 if let Some(n) = e.arg.as_mut() {
781 if let Some(n) = n.node.as_mut() {
782 iter.push((n.to_mut(), depth, context));
783 }
784 }
785 }
786 NodeMut::ResTarget(t) => {
787 let t = t.as_mut().unwrap();
788 if let Some(n) = t.val.as_mut() {
789 if let Some(n) = n.node.as_mut() {
790 iter.push((n.to_mut(), depth, context));
791 }
792 }
793 }
794 NodeMut::SubLink(l) => {
795 let l = l.as_mut().unwrap();
796 if let Some(n) = l.subselect.as_mut() {
797 if let Some(n) = n.node.as_mut() {
798 iter.push((n.to_mut(), depth, context));
799 }
800 }
801 }
802 NodeMut::FuncCall(c) => {
803 let c = c.as_mut().unwrap();
804 c.args.iter_mut().for_each(|n| {
805 if let Some(n) = n.node.as_mut() {
806 iter.push((n.to_mut(), depth, context));
807 }
808 });
809 }
810 NodeMut::CaseExpr(c) => {
811 let c = c.as_mut().unwrap();
812 c.args.iter_mut().for_each(|n| {
813 if let Some(n) = n.node.as_mut() {
814 iter.push((n.to_mut(), depth, context));
815 }
816 });
817 if let Some(n) = c.defresult.as_mut() {
818 if let Some(n) = n.node.as_mut() {
819 iter.push((n.to_mut(), depth, context));
820 }
821 }
822 }
823 NodeMut::CaseWhen(w) => {
824 let w = w.as_mut().unwrap();
825 if let Some(n) = w.expr.as_mut() {
826 if let Some(n) = n.node.as_mut() {
827 iter.push((n.to_mut(), depth, context));
828 }
829 }
830 if let Some(n) = w.result.as_mut() {
831 if let Some(n) = n.node.as_mut() {
832 iter.push((n.to_mut(), depth, context));
833 }
834 }
835 }
836 NodeMut::SortBy(n) => {
837 let n = n.as_mut().unwrap();
838 if let Some(n) = n.node.as_mut() {
839 if let Some(n) = n.node.as_mut() {
840 iter.push((n.to_mut(), depth, context));
841 }
842 }
843 }
844 NodeMut::TypeCast(t) => {
845 let t = t.as_mut().unwrap();
846 if let Some(n) = t.arg.as_mut() {
847 if let Some(n) = n.node.as_mut() {
848 iter.push((n.to_mut(), depth, context));
849 }
850 }
851 }
852 NodeMut::List(l) => {
856 let l = l.as_mut().unwrap();
857 l.items.iter_mut().for_each(|n| {
858 if let Some(n) = n.node.as_mut() {
859 iter.push((n.to_mut(), depth, context));
860 }
861 });
862 }
863 NodeMut::JoinExpr(e) => {
864 let e = e.as_mut().unwrap();
865 if let Some(n) = e.larg.as_mut() {
866 if let Some(n) = n.node.as_mut() {
867 iter.push((n.to_mut(), depth, context));
868 }
869 }
870 if let Some(n) = e.rarg.as_mut() {
871 if let Some(n) = n.node.as_mut() {
872 iter.push((n.to_mut(), depth, context));
873 }
874 }
875 if let Some(n) = e.quals.as_mut() {
876 if let Some(n) = n.node.as_mut() {
877 iter.push((n.to_mut(), depth, context));
878 }
879 }
880 }
881 NodeMut::RowExpr(e) => {
882 let e = e.as_mut().unwrap();
883 e.args.iter_mut().for_each(|n| {
884 if let Some(n) = n.node.as_mut() {
885 iter.push((n.to_mut(), depth, context));
886 }
887 });
888 }
889 NodeMut::RangeSubselect(s) => {
890 let s = s.as_mut().unwrap();
891 if let Some(n) = s.subquery.as_mut() {
892 if let Some(n) = n.node.as_mut() {
893 iter.push((n.to_mut(), depth, context));
894 }
895 }
896 }
897 NodeMut::RangeFunction(f) => {
898 let f = f.as_mut().unwrap();
899 f.functions.iter_mut().for_each(|n| {
900 if let Some(n) = n.node.as_mut() {
901 iter.push((n.to_mut(), depth, context));
902 }
903 });
904 }
905 _ => (),
906 }
907 nodes.push((node, depth, context));
908 }
909 nodes
910 }
911
912 pub fn to_ref(&self) -> NodeRef {
913 match self {
914 NodeEnum::Alias(n) => NodeRef::Alias(n),
915 NodeEnum::RangeVar(n) => NodeRef::RangeVar(n),
916 NodeEnum::TableFunc(n) => NodeRef::TableFunc(n),
917 NodeEnum::Var(n) => NodeRef::Var(n),
918 NodeEnum::Param(n) => NodeRef::Param(n),
919 NodeEnum::Aggref(n) => NodeRef::Aggref(n),
920 NodeEnum::GroupingFunc(n) => NodeRef::GroupingFunc(n),
921 NodeEnum::WindowFunc(n) => NodeRef::WindowFunc(n),
922 NodeEnum::SubscriptingRef(n) => NodeRef::SubscriptingRef(n),
923 NodeEnum::FuncExpr(n) => NodeRef::FuncExpr(n),
924 NodeEnum::NamedArgExpr(n) => NodeRef::NamedArgExpr(n),
925 NodeEnum::OpExpr(n) => NodeRef::OpExpr(n),
926 NodeEnum::DistinctExpr(n) => NodeRef::DistinctExpr(n),
927 NodeEnum::NullIfExpr(n) => NodeRef::NullIfExpr(n),
928 NodeEnum::ScalarArrayOpExpr(n) => NodeRef::ScalarArrayOpExpr(n),
929 NodeEnum::BoolExpr(n) => NodeRef::BoolExpr(n),
930 NodeEnum::SubLink(n) => NodeRef::SubLink(n),
931 NodeEnum::SubPlan(n) => NodeRef::SubPlan(n),
932 NodeEnum::AlternativeSubPlan(n) => NodeRef::AlternativeSubPlan(n),
933 NodeEnum::FieldSelect(n) => NodeRef::FieldSelect(n),
934 NodeEnum::FieldStore(n) => NodeRef::FieldStore(n),
935 NodeEnum::RelabelType(n) => NodeRef::RelabelType(n),
936 NodeEnum::CoerceViaIo(n) => NodeRef::CoerceViaIo(n),
937 NodeEnum::ArrayCoerceExpr(n) => NodeRef::ArrayCoerceExpr(n),
938 NodeEnum::ConvertRowtypeExpr(n) => NodeRef::ConvertRowtypeExpr(n),
939 NodeEnum::CollateExpr(n) => NodeRef::CollateExpr(n),
940 NodeEnum::CaseExpr(n) => NodeRef::CaseExpr(n),
941 NodeEnum::CaseWhen(n) => NodeRef::CaseWhen(n),
942 NodeEnum::CaseTestExpr(n) => NodeRef::CaseTestExpr(n),
943 NodeEnum::ArrayExpr(n) => NodeRef::ArrayExpr(n),
944 NodeEnum::RowExpr(n) => NodeRef::RowExpr(n),
945 NodeEnum::RowCompareExpr(n) => NodeRef::RowCompareExpr(n),
946 NodeEnum::CoalesceExpr(n) => NodeRef::CoalesceExpr(n),
947 NodeEnum::MinMaxExpr(n) => NodeRef::MinMaxExpr(n),
948 NodeEnum::SqlvalueFunction(n) => NodeRef::SqlvalueFunction(n),
949 NodeEnum::XmlExpr(n) => NodeRef::XmlExpr(n),
950 NodeEnum::NullTest(n) => NodeRef::NullTest(n),
951 NodeEnum::BooleanTest(n) => NodeRef::BooleanTest(n),
952 NodeEnum::CoerceToDomain(n) => NodeRef::CoerceToDomain(n),
953 NodeEnum::CoerceToDomainValue(n) => NodeRef::CoerceToDomainValue(n),
954 NodeEnum::SetToDefault(n) => NodeRef::SetToDefault(n),
955 NodeEnum::CurrentOfExpr(n) => NodeRef::CurrentOfExpr(n),
956 NodeEnum::NextValueExpr(n) => NodeRef::NextValueExpr(n),
957 NodeEnum::InferenceElem(n) => NodeRef::InferenceElem(n),
958 NodeEnum::TargetEntry(n) => NodeRef::TargetEntry(n),
959 NodeEnum::RangeTblRef(n) => NodeRef::RangeTblRef(n),
960 NodeEnum::JoinExpr(n) => NodeRef::JoinExpr(n),
961 NodeEnum::FromExpr(n) => NodeRef::FromExpr(n),
962 NodeEnum::OnConflictExpr(n) => NodeRef::OnConflictExpr(n),
963 NodeEnum::IntoClause(n) => NodeRef::IntoClause(n),
964 NodeEnum::RawStmt(n) => NodeRef::RawStmt(n),
965 NodeEnum::Query(n) => NodeRef::Query(n),
966 NodeEnum::InsertStmt(n) => NodeRef::InsertStmt(n),
967 NodeEnum::DeleteStmt(n) => NodeRef::DeleteStmt(n),
968 NodeEnum::UpdateStmt(n) => NodeRef::UpdateStmt(n),
969 NodeEnum::SelectStmt(n) => NodeRef::SelectStmt(n),
970 NodeEnum::AlterTableStmt(n) => NodeRef::AlterTableStmt(n),
971 NodeEnum::AlterTableCmd(n) => NodeRef::AlterTableCmd(n),
972 NodeEnum::AlterDomainStmt(n) => NodeRef::AlterDomainStmt(n),
973 NodeEnum::SetOperationStmt(n) => NodeRef::SetOperationStmt(n),
974 NodeEnum::GrantStmt(n) => NodeRef::GrantStmt(n),
975 NodeEnum::GrantRoleStmt(n) => NodeRef::GrantRoleStmt(n),
976 NodeEnum::AlterDefaultPrivilegesStmt(n) => NodeRef::AlterDefaultPrivilegesStmt(n),
977 NodeEnum::ClosePortalStmt(n) => NodeRef::ClosePortalStmt(n),
978 NodeEnum::ClusterStmt(n) => NodeRef::ClusterStmt(n),
979 NodeEnum::CopyStmt(n) => NodeRef::CopyStmt(n),
980 NodeEnum::CreateStmt(n) => NodeRef::CreateStmt(n),
981 NodeEnum::DefineStmt(n) => NodeRef::DefineStmt(n),
982 NodeEnum::DropStmt(n) => NodeRef::DropStmt(n),
983 NodeEnum::TruncateStmt(n) => NodeRef::TruncateStmt(n),
984 NodeEnum::CommentStmt(n) => NodeRef::CommentStmt(n),
985 NodeEnum::FetchStmt(n) => NodeRef::FetchStmt(n),
986 NodeEnum::IndexStmt(n) => NodeRef::IndexStmt(n),
987 NodeEnum::CreateFunctionStmt(n) => NodeRef::CreateFunctionStmt(n),
988 NodeEnum::AlterFunctionStmt(n) => NodeRef::AlterFunctionStmt(n),
989 NodeEnum::DoStmt(n) => NodeRef::DoStmt(n),
990 NodeEnum::RenameStmt(n) => NodeRef::RenameStmt(n),
991 NodeEnum::RuleStmt(n) => NodeRef::RuleStmt(n),
992 NodeEnum::NotifyStmt(n) => NodeRef::NotifyStmt(n),
993 NodeEnum::ListenStmt(n) => NodeRef::ListenStmt(n),
994 NodeEnum::UnlistenStmt(n) => NodeRef::UnlistenStmt(n),
995 NodeEnum::TransactionStmt(n) => NodeRef::TransactionStmt(n),
996 NodeEnum::ViewStmt(n) => NodeRef::ViewStmt(n),
997 NodeEnum::LoadStmt(n) => NodeRef::LoadStmt(n),
998 NodeEnum::CreateDomainStmt(n) => NodeRef::CreateDomainStmt(n),
999 NodeEnum::CreatedbStmt(n) => NodeRef::CreatedbStmt(n),
1000 NodeEnum::DropdbStmt(n) => NodeRef::DropdbStmt(n),
1001 NodeEnum::VacuumStmt(n) => NodeRef::VacuumStmt(n),
1002 NodeEnum::ExplainStmt(n) => NodeRef::ExplainStmt(n),
1003 NodeEnum::CreateTableAsStmt(n) => NodeRef::CreateTableAsStmt(n),
1004 NodeEnum::CreateSeqStmt(n) => NodeRef::CreateSeqStmt(n),
1005 NodeEnum::AlterSeqStmt(n) => NodeRef::AlterSeqStmt(n),
1006 NodeEnum::VariableSetStmt(n) => NodeRef::VariableSetStmt(n),
1007 NodeEnum::VariableShowStmt(n) => NodeRef::VariableShowStmt(n),
1008 NodeEnum::DiscardStmt(n) => NodeRef::DiscardStmt(n),
1009 NodeEnum::CreateTrigStmt(n) => NodeRef::CreateTrigStmt(n),
1010 NodeEnum::CreatePlangStmt(n) => NodeRef::CreatePlangStmt(n),
1011 NodeEnum::CreateRoleStmt(n) => NodeRef::CreateRoleStmt(n),
1012 NodeEnum::AlterRoleStmt(n) => NodeRef::AlterRoleStmt(n),
1013 NodeEnum::DropRoleStmt(n) => NodeRef::DropRoleStmt(n),
1014 NodeEnum::LockStmt(n) => NodeRef::LockStmt(n),
1015 NodeEnum::ConstraintsSetStmt(n) => NodeRef::ConstraintsSetStmt(n),
1016 NodeEnum::ReindexStmt(n) => NodeRef::ReindexStmt(n),
1017 NodeEnum::CheckPointStmt(n) => NodeRef::CheckPointStmt(n),
1018 NodeEnum::CreateSchemaStmt(n) => NodeRef::CreateSchemaStmt(n),
1019 NodeEnum::AlterDatabaseStmt(n) => NodeRef::AlterDatabaseStmt(n),
1020 NodeEnum::AlterDatabaseSetStmt(n) => NodeRef::AlterDatabaseSetStmt(n),
1021 NodeEnum::AlterRoleSetStmt(n) => NodeRef::AlterRoleSetStmt(n),
1022 NodeEnum::CreateConversionStmt(n) => NodeRef::CreateConversionStmt(n),
1023 NodeEnum::CreateCastStmt(n) => NodeRef::CreateCastStmt(n),
1024 NodeEnum::CreateOpClassStmt(n) => NodeRef::CreateOpClassStmt(n),
1025 NodeEnum::CreateOpFamilyStmt(n) => NodeRef::CreateOpFamilyStmt(n),
1026 NodeEnum::AlterOpFamilyStmt(n) => NodeRef::AlterOpFamilyStmt(n),
1027 NodeEnum::PrepareStmt(n) => NodeRef::PrepareStmt(n),
1028 NodeEnum::ExecuteStmt(n) => NodeRef::ExecuteStmt(n),
1029 NodeEnum::DeallocateStmt(n) => NodeRef::DeallocateStmt(n),
1030 NodeEnum::DeclareCursorStmt(n) => NodeRef::DeclareCursorStmt(n),
1031 NodeEnum::CreateTableSpaceStmt(n) => NodeRef::CreateTableSpaceStmt(n),
1032 NodeEnum::DropTableSpaceStmt(n) => NodeRef::DropTableSpaceStmt(n),
1033 NodeEnum::AlterObjectDependsStmt(n) => NodeRef::AlterObjectDependsStmt(n),
1034 NodeEnum::AlterObjectSchemaStmt(n) => NodeRef::AlterObjectSchemaStmt(n),
1035 NodeEnum::AlterOwnerStmt(n) => NodeRef::AlterOwnerStmt(n),
1036 NodeEnum::AlterOperatorStmt(n) => NodeRef::AlterOperatorStmt(n),
1037 NodeEnum::AlterTypeStmt(n) => NodeRef::AlterTypeStmt(n),
1038 NodeEnum::DropOwnedStmt(n) => NodeRef::DropOwnedStmt(n),
1039 NodeEnum::ReassignOwnedStmt(n) => NodeRef::ReassignOwnedStmt(n),
1040 NodeEnum::CompositeTypeStmt(n) => NodeRef::CompositeTypeStmt(n),
1041 NodeEnum::CreateEnumStmt(n) => NodeRef::CreateEnumStmt(n),
1042 NodeEnum::CreateRangeStmt(n) => NodeRef::CreateRangeStmt(n),
1043 NodeEnum::AlterEnumStmt(n) => NodeRef::AlterEnumStmt(n),
1044 NodeEnum::AlterTsdictionaryStmt(n) => NodeRef::AlterTsdictionaryStmt(n),
1045 NodeEnum::AlterTsconfigurationStmt(n) => NodeRef::AlterTsconfigurationStmt(n),
1046 NodeEnum::CreateFdwStmt(n) => NodeRef::CreateFdwStmt(n),
1047 NodeEnum::AlterFdwStmt(n) => NodeRef::AlterFdwStmt(n),
1048 NodeEnum::CreateForeignServerStmt(n) => NodeRef::CreateForeignServerStmt(n),
1049 NodeEnum::AlterForeignServerStmt(n) => NodeRef::AlterForeignServerStmt(n),
1050 NodeEnum::CreateUserMappingStmt(n) => NodeRef::CreateUserMappingStmt(n),
1051 NodeEnum::AlterUserMappingStmt(n) => NodeRef::AlterUserMappingStmt(n),
1052 NodeEnum::DropUserMappingStmt(n) => NodeRef::DropUserMappingStmt(n),
1053 NodeEnum::AlterTableSpaceOptionsStmt(n) => NodeRef::AlterTableSpaceOptionsStmt(n),
1054 NodeEnum::AlterTableMoveAllStmt(n) => NodeRef::AlterTableMoveAllStmt(n),
1055 NodeEnum::SecLabelStmt(n) => NodeRef::SecLabelStmt(n),
1056 NodeEnum::CreateForeignTableStmt(n) => NodeRef::CreateForeignTableStmt(n),
1057 NodeEnum::ImportForeignSchemaStmt(n) => NodeRef::ImportForeignSchemaStmt(n),
1058 NodeEnum::CreateExtensionStmt(n) => NodeRef::CreateExtensionStmt(n),
1059 NodeEnum::AlterExtensionStmt(n) => NodeRef::AlterExtensionStmt(n),
1060 NodeEnum::AlterExtensionContentsStmt(n) => NodeRef::AlterExtensionContentsStmt(n),
1061 NodeEnum::CreateEventTrigStmt(n) => NodeRef::CreateEventTrigStmt(n),
1062 NodeEnum::AlterEventTrigStmt(n) => NodeRef::AlterEventTrigStmt(n),
1063 NodeEnum::RefreshMatViewStmt(n) => NodeRef::RefreshMatViewStmt(n),
1064 NodeEnum::ReplicaIdentityStmt(n) => NodeRef::ReplicaIdentityStmt(n),
1065 NodeEnum::AlterSystemStmt(n) => NodeRef::AlterSystemStmt(n),
1066 NodeEnum::CreatePolicyStmt(n) => NodeRef::CreatePolicyStmt(n),
1067 NodeEnum::AlterPolicyStmt(n) => NodeRef::AlterPolicyStmt(n),
1068 NodeEnum::CreateTransformStmt(n) => NodeRef::CreateTransformStmt(n),
1069 NodeEnum::CreateAmStmt(n) => NodeRef::CreateAmStmt(n),
1070 NodeEnum::CreatePublicationStmt(n) => NodeRef::CreatePublicationStmt(n),
1071 NodeEnum::AlterPublicationStmt(n) => NodeRef::AlterPublicationStmt(n),
1072 NodeEnum::CreateSubscriptionStmt(n) => NodeRef::CreateSubscriptionStmt(n),
1073 NodeEnum::AlterSubscriptionStmt(n) => NodeRef::AlterSubscriptionStmt(n),
1074 NodeEnum::DropSubscriptionStmt(n) => NodeRef::DropSubscriptionStmt(n),
1075 NodeEnum::CreateStatsStmt(n) => NodeRef::CreateStatsStmt(n),
1076 NodeEnum::AlterCollationStmt(n) => NodeRef::AlterCollationStmt(n),
1077 NodeEnum::CallStmt(n) => NodeRef::CallStmt(n),
1078 NodeEnum::AlterStatsStmt(n) => NodeRef::AlterStatsStmt(n),
1079 NodeEnum::AExpr(n) => NodeRef::AExpr(n),
1080 NodeEnum::ColumnRef(n) => NodeRef::ColumnRef(n),
1081 NodeEnum::ParamRef(n) => NodeRef::ParamRef(n),
1082 NodeEnum::AConst(n) => NodeRef::AConst(n),
1083 NodeEnum::FuncCall(n) => NodeRef::FuncCall(n),
1084 NodeEnum::AStar(n) => NodeRef::AStar(n),
1085 NodeEnum::AIndices(n) => NodeRef::AIndices(n),
1086 NodeEnum::AIndirection(n) => NodeRef::AIndirection(n),
1087 NodeEnum::AArrayExpr(n) => NodeRef::AArrayExpr(n),
1088 NodeEnum::ResTarget(n) => NodeRef::ResTarget(n),
1089 NodeEnum::MultiAssignRef(n) => NodeRef::MultiAssignRef(n),
1090 NodeEnum::TypeCast(n) => NodeRef::TypeCast(n),
1091 NodeEnum::CollateClause(n) => NodeRef::CollateClause(n),
1092 NodeEnum::SortBy(n) => NodeRef::SortBy(n),
1093 NodeEnum::WindowDef(n) => NodeRef::WindowDef(n),
1094 NodeEnum::RangeSubselect(n) => NodeRef::RangeSubselect(n),
1095 NodeEnum::RangeFunction(n) => NodeRef::RangeFunction(n),
1096 NodeEnum::RangeTableSample(n) => NodeRef::RangeTableSample(n),
1097 NodeEnum::RangeTableFunc(n) => NodeRef::RangeTableFunc(n),
1098 NodeEnum::RangeTableFuncCol(n) => NodeRef::RangeTableFuncCol(n),
1099 NodeEnum::TypeName(n) => NodeRef::TypeName(n),
1100 NodeEnum::ColumnDef(n) => NodeRef::ColumnDef(n),
1101 NodeEnum::IndexElem(n) => NodeRef::IndexElem(n),
1102 NodeEnum::Constraint(n) => NodeRef::Constraint(n),
1103 NodeEnum::DefElem(n) => NodeRef::DefElem(n),
1104 NodeEnum::RangeTblEntry(n) => NodeRef::RangeTblEntry(n),
1105 NodeEnum::RangeTblFunction(n) => NodeRef::RangeTblFunction(n),
1106 NodeEnum::TableSampleClause(n) => NodeRef::TableSampleClause(n),
1107 NodeEnum::WithCheckOption(n) => NodeRef::WithCheckOption(n),
1108 NodeEnum::SortGroupClause(n) => NodeRef::SortGroupClause(n),
1109 NodeEnum::GroupingSet(n) => NodeRef::GroupingSet(n),
1110 NodeEnum::WindowClause(n) => NodeRef::WindowClause(n),
1111 NodeEnum::ObjectWithArgs(n) => NodeRef::ObjectWithArgs(n),
1112 NodeEnum::AccessPriv(n) => NodeRef::AccessPriv(n),
1113 NodeEnum::CreateOpClassItem(n) => NodeRef::CreateOpClassItem(n),
1114 NodeEnum::TableLikeClause(n) => NodeRef::TableLikeClause(n),
1115 NodeEnum::FunctionParameter(n) => NodeRef::FunctionParameter(n),
1116 NodeEnum::LockingClause(n) => NodeRef::LockingClause(n),
1117 NodeEnum::RowMarkClause(n) => NodeRef::RowMarkClause(n),
1118 NodeEnum::XmlSerialize(n) => NodeRef::XmlSerialize(n),
1119 NodeEnum::WithClause(n) => NodeRef::WithClause(n),
1120 NodeEnum::InferClause(n) => NodeRef::InferClause(n),
1121 NodeEnum::OnConflictClause(n) => NodeRef::OnConflictClause(n),
1122 NodeEnum::CommonTableExpr(n) => NodeRef::CommonTableExpr(n),
1123 NodeEnum::RoleSpec(n) => NodeRef::RoleSpec(n),
1124 NodeEnum::TriggerTransition(n) => NodeRef::TriggerTransition(n),
1125 NodeEnum::PartitionElem(n) => NodeRef::PartitionElem(n),
1126 NodeEnum::PartitionSpec(n) => NodeRef::PartitionSpec(n),
1127 NodeEnum::PartitionBoundSpec(n) => NodeRef::PartitionBoundSpec(n),
1128 NodeEnum::PartitionRangeDatum(n) => NodeRef::PartitionRangeDatum(n),
1129 NodeEnum::PartitionCmd(n) => NodeRef::PartitionCmd(n),
1130 NodeEnum::VacuumRelation(n) => NodeRef::VacuumRelation(n),
1131 NodeEnum::InlineCodeBlock(n) => NodeRef::InlineCodeBlock(n),
1132 NodeEnum::CallContext(n) => NodeRef::CallContext(n),
1133 NodeEnum::Integer(n) => NodeRef::Integer(n),
1134 NodeEnum::Float(n) => NodeRef::Float(n),
1135 NodeEnum::Boolean(n) => NodeRef::Boolean(n),
1136 NodeEnum::String(n) => NodeRef::String(n),
1137 NodeEnum::BitString(n) => NodeRef::BitString(n),
1138 NodeEnum::List(n) => NodeRef::List(n),
1139 NodeEnum::IntList(n) => NodeRef::IntList(n),
1140 NodeEnum::OidList(n) => NodeRef::OidList(n),
1141 NodeEnum::MergeStmt(n) => NodeRef::MergeStmt(n),
1142 NodeEnum::MergeAction(n) => NodeRef::MergeAction(n),
1143 NodeEnum::AlterDatabaseRefreshCollStmt(n) => NodeRef::AlterDatabaseRefreshCollStmt(n),
1144 NodeEnum::ReturnStmt(n) => NodeRef::ReturnStmt(n),
1145 NodeEnum::PlassignStmt(n) => NodeRef::PlassignStmt(n),
1146 NodeEnum::StatsElem(n) => NodeRef::StatsElem(n),
1147 NodeEnum::CtesearchClause(n) => NodeRef::CtesearchClause(n),
1148 NodeEnum::CtecycleClause(n) => NodeRef::CtecycleClause(n),
1149 NodeEnum::MergeWhenClause(n) => NodeRef::MergeWhenClause(n),
1150 NodeEnum::PublicationObjSpec(n) => NodeRef::PublicationObjSpec(n),
1151 NodeEnum::PublicationTable(n) => NodeRef::PublicationTable(n),
1152 NodeEnum::JsonFormat(n) => NodeRef::JsonFormat(n),
1153 NodeEnum::JsonReturning(n) => NodeRef::JsonReturning(n),
1154 NodeEnum::JsonValueExpr(n) => NodeRef::JsonValueExpr(n),
1155 NodeEnum::JsonConstructorExpr(n) => NodeRef::JsonConstructorExpr(n),
1156 NodeEnum::JsonIsPredicate(n) => NodeRef::JsonIsPredicate(n),
1157 NodeEnum::JsonOutput(n) => NodeRef::JsonOutput(n),
1158 NodeEnum::JsonKeyValue(n) => NodeRef::JsonKeyValue(n),
1159 NodeEnum::JsonObjectConstructor(n) => NodeRef::JsonObjectConstructor(n),
1160 NodeEnum::JsonArrayConstructor(n) => NodeRef::JsonArrayConstructor(n),
1161 NodeEnum::JsonArrayQueryConstructor(n) => NodeRef::JsonArrayQueryConstructor(n),
1162 NodeEnum::JsonAggConstructor(n) => NodeRef::JsonAggConstructor(n),
1163 NodeEnum::JsonObjectAgg(n) => NodeRef::JsonObjectAgg(n),
1164 NodeEnum::JsonArrayAgg(n) => NodeRef::JsonArrayAgg(n),
1165 NodeEnum::RtepermissionInfo(n) => NodeRef::RtepermissionInfo(n),
1166 NodeEnum::WindowFuncRunCondition(n) => NodeRef::WindowFuncRunCondition(n),
1167 NodeEnum::MergeSupportFunc(n) => NodeRef::MergeSupportFunc(n),
1168 NodeEnum::JsonBehavior(n) => NodeRef::JsonBehavior(n),
1169 NodeEnum::JsonExpr(n) => NodeRef::JsonExpr(n),
1170 NodeEnum::JsonTablePath(n) => NodeRef::JsonTablePath(n),
1171 NodeEnum::JsonTablePathScan(n) => NodeRef::JsonTablePathScan(n),
1172 NodeEnum::JsonTableSiblingJoin(n) => NodeRef::JsonTableSiblingJoin(n),
1173 NodeEnum::SinglePartitionSpec(n) => NodeRef::SinglePartitionSpec(n),
1174 NodeEnum::JsonArgument(n) => NodeRef::JsonArgument(n),
1175 NodeEnum::JsonFuncExpr(n) => NodeRef::JsonFuncExpr(n),
1176 NodeEnum::JsonTablePathSpec(n) => NodeRef::JsonTablePathSpec(n),
1177 NodeEnum::JsonTable(n) => NodeRef::JsonTable(n),
1178 NodeEnum::JsonTableColumn(n) => NodeRef::JsonTableColumn(n),
1179 NodeEnum::JsonParseExpr(n) => NodeRef::JsonParseExpr(n),
1180 NodeEnum::JsonScalarExpr(n) => NodeRef::JsonScalarExpr(n),
1181 NodeEnum::JsonSerializeExpr(n) => NodeRef::JsonSerializeExpr(n),
1182 }
1183 }
1184
1185 pub fn to_mut(&mut self) -> NodeMut {
1186 match self {
1187 NodeEnum::Alias(n) => NodeMut::Alias(n as *mut _),
1188 NodeEnum::RangeVar(n) => NodeMut::RangeVar(n as *mut _),
1189 NodeEnum::TableFunc(n) => NodeMut::TableFunc(&mut **n as *mut _),
1190 NodeEnum::Var(n) => NodeMut::Var(&mut **n as *mut _),
1191 NodeEnum::Param(n) => NodeMut::Param(&mut **n as *mut _),
1192 NodeEnum::Aggref(n) => NodeMut::Aggref(&mut **n as *mut _),
1193 NodeEnum::GroupingFunc(n) => NodeMut::GroupingFunc(&mut **n as *mut _),
1194 NodeEnum::WindowFunc(n) => NodeMut::WindowFunc(&mut **n as *mut _),
1195 NodeEnum::SubscriptingRef(n) => NodeMut::SubscriptingRef(&mut **n as *mut _),
1196 NodeEnum::FuncExpr(n) => NodeMut::FuncExpr(&mut **n as *mut _),
1197 NodeEnum::NamedArgExpr(n) => NodeMut::NamedArgExpr(&mut **n as *mut _),
1198 NodeEnum::OpExpr(n) => NodeMut::OpExpr(&mut **n as *mut _),
1199 NodeEnum::DistinctExpr(n) => NodeMut::DistinctExpr(&mut **n as *mut _),
1200 NodeEnum::NullIfExpr(n) => NodeMut::NullIfExpr(&mut **n as *mut _),
1201 NodeEnum::ScalarArrayOpExpr(n) => NodeMut::ScalarArrayOpExpr(&mut **n as *mut _),
1202 NodeEnum::BoolExpr(n) => NodeMut::BoolExpr(&mut **n as *mut _),
1203 NodeEnum::SubLink(n) => NodeMut::SubLink(&mut **n as *mut _),
1204 NodeEnum::SubPlan(n) => NodeMut::SubPlan(&mut **n as *mut _),
1205 NodeEnum::AlternativeSubPlan(n) => NodeMut::AlternativeSubPlan(&mut **n as *mut _),
1206 NodeEnum::FieldSelect(n) => NodeMut::FieldSelect(&mut **n as *mut _),
1207 NodeEnum::FieldStore(n) => NodeMut::FieldStore(&mut **n as *mut _),
1208 NodeEnum::RelabelType(n) => NodeMut::RelabelType(&mut **n as *mut _),
1209 NodeEnum::CoerceViaIo(n) => NodeMut::CoerceViaIo(&mut **n as *mut _),
1210 NodeEnum::ArrayCoerceExpr(n) => NodeMut::ArrayCoerceExpr(&mut **n as *mut _),
1211 NodeEnum::ConvertRowtypeExpr(n) => NodeMut::ConvertRowtypeExpr(&mut **n as *mut _),
1212 NodeEnum::CollateExpr(n) => NodeMut::CollateExpr(&mut **n as *mut _),
1213 NodeEnum::CaseExpr(n) => NodeMut::CaseExpr(&mut **n as *mut _),
1214 NodeEnum::CaseWhen(n) => NodeMut::CaseWhen(&mut **n as *mut _),
1215 NodeEnum::CaseTestExpr(n) => NodeMut::CaseTestExpr(&mut **n as *mut _),
1216 NodeEnum::ArrayExpr(n) => NodeMut::ArrayExpr(&mut **n as *mut _),
1217 NodeEnum::RowExpr(n) => NodeMut::RowExpr(&mut **n as *mut _),
1218 NodeEnum::RowCompareExpr(n) => NodeMut::RowCompareExpr(&mut **n as *mut _),
1219 NodeEnum::CoalesceExpr(n) => NodeMut::CoalesceExpr(&mut **n as *mut _),
1220 NodeEnum::MinMaxExpr(n) => NodeMut::MinMaxExpr(&mut **n as *mut _),
1221 NodeEnum::SqlvalueFunction(n) => NodeMut::SqlvalueFunction(&mut **n as *mut _),
1222 NodeEnum::XmlExpr(n) => NodeMut::XmlExpr(&mut **n as *mut _),
1223 NodeEnum::NullTest(n) => NodeMut::NullTest(&mut **n as *mut _),
1224 NodeEnum::BooleanTest(n) => NodeMut::BooleanTest(&mut **n as *mut _),
1225 NodeEnum::CoerceToDomain(n) => NodeMut::CoerceToDomain(&mut **n as *mut _),
1226 NodeEnum::CoerceToDomainValue(n) => NodeMut::CoerceToDomainValue(&mut **n as *mut _),
1227 NodeEnum::SetToDefault(n) => NodeMut::SetToDefault(&mut **n as *mut _),
1228 NodeEnum::CurrentOfExpr(n) => NodeMut::CurrentOfExpr(&mut **n as *mut _),
1229 NodeEnum::NextValueExpr(n) => NodeMut::NextValueExpr(&mut **n as *mut _),
1230 NodeEnum::InferenceElem(n) => NodeMut::InferenceElem(&mut **n as *mut _),
1231 NodeEnum::TargetEntry(n) => NodeMut::TargetEntry(&mut **n as *mut _),
1232 NodeEnum::RangeTblRef(n) => NodeMut::RangeTblRef(n as *mut _),
1233 NodeEnum::JoinExpr(n) => NodeMut::JoinExpr(&mut **n as *mut _),
1234 NodeEnum::FromExpr(n) => NodeMut::FromExpr(&mut **n as *mut _),
1235 NodeEnum::OnConflictExpr(n) => NodeMut::OnConflictExpr(&mut **n as *mut _),
1236 NodeEnum::IntoClause(n) => NodeMut::IntoClause(&mut **n as *mut _),
1237 NodeEnum::RawStmt(n) => NodeMut::RawStmt(&mut **n as *mut _),
1238 NodeEnum::Query(n) => NodeMut::Query(&mut **n as *mut _),
1239 NodeEnum::InsertStmt(n) => NodeMut::InsertStmt(&mut **n as *mut _),
1240 NodeEnum::DeleteStmt(n) => NodeMut::DeleteStmt(&mut **n as *mut _),
1241 NodeEnum::UpdateStmt(n) => NodeMut::UpdateStmt(&mut **n as *mut _),
1242 NodeEnum::SelectStmt(n) => NodeMut::SelectStmt(&mut **n as *mut _),
1243 NodeEnum::AlterTableStmt(n) => NodeMut::AlterTableStmt(n as *mut _),
1244 NodeEnum::AlterTableCmd(n) => NodeMut::AlterTableCmd(&mut **n as *mut _),
1245 NodeEnum::AlterDomainStmt(n) => NodeMut::AlterDomainStmt(&mut **n as *mut _),
1246 NodeEnum::SetOperationStmt(n) => NodeMut::SetOperationStmt(&mut **n as *mut _),
1247 NodeEnum::GrantStmt(n) => NodeMut::GrantStmt(n as *mut _),
1248 NodeEnum::GrantRoleStmt(n) => NodeMut::GrantRoleStmt(n as *mut _),
1249 NodeEnum::AlterDefaultPrivilegesStmt(n) => NodeMut::AlterDefaultPrivilegesStmt(n as *mut _),
1250 NodeEnum::ClosePortalStmt(n) => NodeMut::ClosePortalStmt(n as *mut _),
1251 NodeEnum::ClusterStmt(n) => NodeMut::ClusterStmt(n as *mut _),
1252 NodeEnum::CopyStmt(n) => NodeMut::CopyStmt(&mut **n as *mut _),
1253 NodeEnum::CreateStmt(n) => NodeMut::CreateStmt(n as *mut _),
1254 NodeEnum::DefineStmt(n) => NodeMut::DefineStmt(n as *mut _),
1255 NodeEnum::DropStmt(n) => NodeMut::DropStmt(n as *mut _),
1256 NodeEnum::TruncateStmt(n) => NodeMut::TruncateStmt(n as *mut _),
1257 NodeEnum::CommentStmt(n) => NodeMut::CommentStmt(&mut **n as *mut _),
1258 NodeEnum::FetchStmt(n) => NodeMut::FetchStmt(n as *mut _),
1259 NodeEnum::IndexStmt(n) => NodeMut::IndexStmt(&mut **n as *mut _),
1260 NodeEnum::CreateFunctionStmt(n) => NodeMut::CreateFunctionStmt(&mut **n as *mut _),
1261 NodeEnum::AlterFunctionStmt(n) => NodeMut::AlterFunctionStmt(n as *mut _),
1262 NodeEnum::DoStmt(n) => NodeMut::DoStmt(n as *mut _),
1263 NodeEnum::RenameStmt(n) => NodeMut::RenameStmt(&mut **n as *mut _),
1264 NodeEnum::RuleStmt(n) => NodeMut::RuleStmt(&mut **n as *mut _),
1265 NodeEnum::NotifyStmt(n) => NodeMut::NotifyStmt(n as *mut _),
1266 NodeEnum::ListenStmt(n) => NodeMut::ListenStmt(n as *mut _),
1267 NodeEnum::UnlistenStmt(n) => NodeMut::UnlistenStmt(n as *mut _),
1268 NodeEnum::TransactionStmt(n) => NodeMut::TransactionStmt(n as *mut _),
1269 NodeEnum::ViewStmt(n) => NodeMut::ViewStmt(&mut **n as *mut _),
1270 NodeEnum::LoadStmt(n) => NodeMut::LoadStmt(n as *mut _),
1271 NodeEnum::CreateDomainStmt(n) => NodeMut::CreateDomainStmt(&mut **n as *mut _),
1272 NodeEnum::CreatedbStmt(n) => NodeMut::CreatedbStmt(n as *mut _),
1273 NodeEnum::DropdbStmt(n) => NodeMut::DropdbStmt(n as *mut _),
1274 NodeEnum::VacuumStmt(n) => NodeMut::VacuumStmt(n as *mut _),
1275 NodeEnum::ExplainStmt(n) => NodeMut::ExplainStmt(&mut **n as *mut _),
1276 NodeEnum::CreateTableAsStmt(n) => NodeMut::CreateTableAsStmt(&mut **n as *mut _),
1277 NodeEnum::CreateSeqStmt(n) => NodeMut::CreateSeqStmt(n as *mut _),
1278 NodeEnum::AlterSeqStmt(n) => NodeMut::AlterSeqStmt(n as *mut _),
1279 NodeEnum::VariableSetStmt(n) => NodeMut::VariableSetStmt(n as *mut _),
1280 NodeEnum::VariableShowStmt(n) => NodeMut::VariableShowStmt(n as *mut _),
1281 NodeEnum::DiscardStmt(n) => NodeMut::DiscardStmt(n as *mut _),
1282 NodeEnum::CreateTrigStmt(n) => NodeMut::CreateTrigStmt(&mut **n as *mut _),
1283 NodeEnum::CreatePlangStmt(n) => NodeMut::CreatePlangStmt(n as *mut _),
1284 NodeEnum::CreateRoleStmt(n) => NodeMut::CreateRoleStmt(n as *mut _),
1285 NodeEnum::AlterRoleStmt(n) => NodeMut::AlterRoleStmt(n as *mut _),
1286 NodeEnum::DropRoleStmt(n) => NodeMut::DropRoleStmt(n as *mut _),
1287 NodeEnum::LockStmt(n) => NodeMut::LockStmt(n as *mut _),
1288 NodeEnum::ConstraintsSetStmt(n) => NodeMut::ConstraintsSetStmt(n as *mut _),
1289 NodeEnum::ReindexStmt(n) => NodeMut::ReindexStmt(n as *mut _),
1290 NodeEnum::CheckPointStmt(n) => NodeMut::CheckPointStmt(n as *mut _),
1291 NodeEnum::CreateSchemaStmt(n) => NodeMut::CreateSchemaStmt(n as *mut _),
1292 NodeEnum::AlterDatabaseStmt(n) => NodeMut::AlterDatabaseStmt(n as *mut _),
1293 NodeEnum::AlterDatabaseSetStmt(n) => NodeMut::AlterDatabaseSetStmt(n as *mut _),
1294 NodeEnum::AlterRoleSetStmt(n) => NodeMut::AlterRoleSetStmt(n as *mut _),
1295 NodeEnum::CreateConversionStmt(n) => NodeMut::CreateConversionStmt(n as *mut _),
1296 NodeEnum::CreateCastStmt(n) => NodeMut::CreateCastStmt(n as *mut _),
1297 NodeEnum::CreateOpClassStmt(n) => NodeMut::CreateOpClassStmt(n as *mut _),
1298 NodeEnum::CreateOpFamilyStmt(n) => NodeMut::CreateOpFamilyStmt(n as *mut _),
1299 NodeEnum::AlterOpFamilyStmt(n) => NodeMut::AlterOpFamilyStmt(n as *mut _),
1300 NodeEnum::PrepareStmt(n) => NodeMut::PrepareStmt(&mut **n as *mut _),
1301 NodeEnum::ExecuteStmt(n) => NodeMut::ExecuteStmt(n as *mut _),
1302 NodeEnum::DeallocateStmt(n) => NodeMut::DeallocateStmt(n as *mut _),
1303 NodeEnum::DeclareCursorStmt(n) => NodeMut::DeclareCursorStmt(&mut **n as *mut _),
1304 NodeEnum::CreateTableSpaceStmt(n) => NodeMut::CreateTableSpaceStmt(n as *mut _),
1305 NodeEnum::DropTableSpaceStmt(n) => NodeMut::DropTableSpaceStmt(n as *mut _),
1306 NodeEnum::AlterObjectDependsStmt(n) => NodeMut::AlterObjectDependsStmt(&mut **n as *mut _),
1307 NodeEnum::AlterObjectSchemaStmt(n) => NodeMut::AlterObjectSchemaStmt(&mut **n as *mut _),
1308 NodeEnum::AlterOwnerStmt(n) => NodeMut::AlterOwnerStmt(&mut **n as *mut _),
1309 NodeEnum::AlterOperatorStmt(n) => NodeMut::AlterOperatorStmt(n as *mut _),
1310 NodeEnum::AlterTypeStmt(n) => NodeMut::AlterTypeStmt(n as *mut _),
1311 NodeEnum::DropOwnedStmt(n) => NodeMut::DropOwnedStmt(n as *mut _),
1312 NodeEnum::ReassignOwnedStmt(n) => NodeMut::ReassignOwnedStmt(n as *mut _),
1313 NodeEnum::CompositeTypeStmt(n) => NodeMut::CompositeTypeStmt(n as *mut _),
1314 NodeEnum::CreateEnumStmt(n) => NodeMut::CreateEnumStmt(n as *mut _),
1315 NodeEnum::CreateRangeStmt(n) => NodeMut::CreateRangeStmt(n as *mut _),
1316 NodeEnum::AlterEnumStmt(n) => NodeMut::AlterEnumStmt(n as *mut _),
1317 NodeEnum::AlterTsdictionaryStmt(n) => NodeMut::AlterTsdictionaryStmt(n as *mut _),
1318 NodeEnum::AlterTsconfigurationStmt(n) => NodeMut::AlterTsconfigurationStmt(n as *mut _),
1319 NodeEnum::CreateFdwStmt(n) => NodeMut::CreateFdwStmt(n as *mut _),
1320 NodeEnum::AlterFdwStmt(n) => NodeMut::AlterFdwStmt(n as *mut _),
1321 NodeEnum::CreateForeignServerStmt(n) => NodeMut::CreateForeignServerStmt(n as *mut _),
1322 NodeEnum::AlterForeignServerStmt(n) => NodeMut::AlterForeignServerStmt(n as *mut _),
1323 NodeEnum::CreateUserMappingStmt(n) => NodeMut::CreateUserMappingStmt(n as *mut _),
1324 NodeEnum::AlterUserMappingStmt(n) => NodeMut::AlterUserMappingStmt(n as *mut _),
1325 NodeEnum::DropUserMappingStmt(n) => NodeMut::DropUserMappingStmt(n as *mut _),
1326 NodeEnum::AlterTableSpaceOptionsStmt(n) => NodeMut::AlterTableSpaceOptionsStmt(n as *mut _),
1327 NodeEnum::AlterTableMoveAllStmt(n) => NodeMut::AlterTableMoveAllStmt(n as *mut _),
1328 NodeEnum::SecLabelStmt(n) => NodeMut::SecLabelStmt(&mut **n as *mut _),
1329 NodeEnum::CreateForeignTableStmt(n) => NodeMut::CreateForeignTableStmt(n as *mut _),
1330 NodeEnum::ImportForeignSchemaStmt(n) => NodeMut::ImportForeignSchemaStmt(n as *mut _),
1331 NodeEnum::CreateExtensionStmt(n) => NodeMut::CreateExtensionStmt(n as *mut _),
1332 NodeEnum::AlterExtensionStmt(n) => NodeMut::AlterExtensionStmt(n as *mut _),
1333 NodeEnum::AlterExtensionContentsStmt(n) => NodeMut::AlterExtensionContentsStmt(&mut **n as *mut _),
1334 NodeEnum::CreateEventTrigStmt(n) => NodeMut::CreateEventTrigStmt(n as *mut _),
1335 NodeEnum::AlterEventTrigStmt(n) => NodeMut::AlterEventTrigStmt(n as *mut _),
1336 NodeEnum::RefreshMatViewStmt(n) => NodeMut::RefreshMatViewStmt(n as *mut _),
1337 NodeEnum::ReplicaIdentityStmt(n) => NodeMut::ReplicaIdentityStmt(n as *mut _),
1338 NodeEnum::AlterSystemStmt(n) => NodeMut::AlterSystemStmt(n as *mut _),
1339 NodeEnum::CreatePolicyStmt(n) => NodeMut::CreatePolicyStmt(&mut **n as *mut _),
1340 NodeEnum::AlterPolicyStmt(n) => NodeMut::AlterPolicyStmt(&mut **n as *mut _),
1341 NodeEnum::CreateTransformStmt(n) => NodeMut::CreateTransformStmt(n as *mut _),
1342 NodeEnum::CreateAmStmt(n) => NodeMut::CreateAmStmt(n as *mut _),
1343 NodeEnum::CreatePublicationStmt(n) => NodeMut::CreatePublicationStmt(n as *mut _),
1344 NodeEnum::AlterPublicationStmt(n) => NodeMut::AlterPublicationStmt(n as *mut _),
1345 NodeEnum::CreateSubscriptionStmt(n) => NodeMut::CreateSubscriptionStmt(n as *mut _),
1346 NodeEnum::AlterSubscriptionStmt(n) => NodeMut::AlterSubscriptionStmt(n as *mut _),
1347 NodeEnum::DropSubscriptionStmt(n) => NodeMut::DropSubscriptionStmt(n as *mut _),
1348 NodeEnum::CreateStatsStmt(n) => NodeMut::CreateStatsStmt(n as *mut _),
1349 NodeEnum::AlterCollationStmt(n) => NodeMut::AlterCollationStmt(n as *mut _),
1350 NodeEnum::CallStmt(n) => NodeMut::CallStmt(&mut **n as *mut _),
1351 NodeEnum::AlterStatsStmt(n) => NodeMut::AlterStatsStmt(&mut **n as *mut _),
1352 NodeEnum::AExpr(n) => NodeMut::AExpr(&mut **n as *mut _),
1353 NodeEnum::ColumnRef(n) => NodeMut::ColumnRef(n as *mut _),
1354 NodeEnum::ParamRef(n) => NodeMut::ParamRef(n as *mut _),
1355 NodeEnum::AConst(n) => NodeMut::AConst(n as *mut _),
1356 NodeEnum::FuncCall(n) => NodeMut::FuncCall(&mut **n as *mut _),
1357 NodeEnum::AStar(n) => NodeMut::AStar(n as *mut _),
1358 NodeEnum::AIndices(n) => NodeMut::AIndices(&mut **n as *mut _),
1359 NodeEnum::AIndirection(n) => NodeMut::AIndirection(&mut **n as *mut _),
1360 NodeEnum::AArrayExpr(n) => NodeMut::AArrayExpr(n as *mut _),
1361 NodeEnum::ResTarget(n) => NodeMut::ResTarget(&mut **n as *mut _),
1362 NodeEnum::MultiAssignRef(n) => NodeMut::MultiAssignRef(&mut **n as *mut _),
1363 NodeEnum::TypeCast(n) => NodeMut::TypeCast(&mut **n as *mut _),
1364 NodeEnum::CollateClause(n) => NodeMut::CollateClause(&mut **n as *mut _),
1365 NodeEnum::SortBy(n) => NodeMut::SortBy(&mut **n as *mut _),
1366 NodeEnum::WindowDef(n) => NodeMut::WindowDef(&mut **n as *mut _),
1367 NodeEnum::RangeSubselect(n) => NodeMut::RangeSubselect(&mut **n as *mut _),
1368 NodeEnum::RangeFunction(n) => NodeMut::RangeFunction(n as *mut _),
1369 NodeEnum::RangeTableSample(n) => NodeMut::RangeTableSample(&mut **n as *mut _),
1370 NodeEnum::RangeTableFunc(n) => NodeMut::RangeTableFunc(&mut **n as *mut _),
1371 NodeEnum::RangeTableFuncCol(n) => NodeMut::RangeTableFuncCol(&mut **n as *mut _),
1372 NodeEnum::TypeName(n) => NodeMut::TypeName(n as *mut _),
1373 NodeEnum::ColumnDef(n) => NodeMut::ColumnDef(&mut **n as *mut _),
1374 NodeEnum::IndexElem(n) => NodeMut::IndexElem(&mut **n as *mut _),
1375 NodeEnum::Constraint(n) => NodeMut::Constraint(&mut **n as *mut _),
1376 NodeEnum::DefElem(n) => NodeMut::DefElem(&mut **n as *mut _),
1377 NodeEnum::RangeTblEntry(n) => NodeMut::RangeTblEntry(&mut **n as *mut _),
1378 NodeEnum::RangeTblFunction(n) => NodeMut::RangeTblFunction(&mut **n as *mut _),
1379 NodeEnum::TableSampleClause(n) => NodeMut::TableSampleClause(&mut **n as *mut _),
1380 NodeEnum::WithCheckOption(n) => NodeMut::WithCheckOption(&mut **n as *mut _),
1381 NodeEnum::SortGroupClause(n) => NodeMut::SortGroupClause(n as *mut _),
1382 NodeEnum::GroupingSet(n) => NodeMut::GroupingSet(n as *mut _),
1383 NodeEnum::WindowClause(n) => NodeMut::WindowClause(&mut **n as *mut _),
1384 NodeEnum::ObjectWithArgs(n) => NodeMut::ObjectWithArgs(n as *mut _),
1385 NodeEnum::AccessPriv(n) => NodeMut::AccessPriv(n as *mut _),
1386 NodeEnum::CreateOpClassItem(n) => NodeMut::CreateOpClassItem(n as *mut _),
1387 NodeEnum::TableLikeClause(n) => NodeMut::TableLikeClause(n as *mut _),
1388 NodeEnum::FunctionParameter(n) => NodeMut::FunctionParameter(&mut **n as *mut _),
1389 NodeEnum::LockingClause(n) => NodeMut::LockingClause(n as *mut _),
1390 NodeEnum::RowMarkClause(n) => NodeMut::RowMarkClause(n as *mut _),
1391 NodeEnum::XmlSerialize(n) => NodeMut::XmlSerialize(&mut **n as *mut _),
1392 NodeEnum::WithClause(n) => NodeMut::WithClause(n as *mut _),
1393 NodeEnum::InferClause(n) => NodeMut::InferClause(&mut **n as *mut _),
1394 NodeEnum::OnConflictClause(n) => NodeMut::OnConflictClause(&mut **n as *mut _),
1395 NodeEnum::CommonTableExpr(n) => NodeMut::CommonTableExpr(&mut **n as *mut _),
1396 NodeEnum::RoleSpec(n) => NodeMut::RoleSpec(n as *mut _),
1397 NodeEnum::TriggerTransition(n) => NodeMut::TriggerTransition(n as *mut _),
1398 NodeEnum::PartitionElem(n) => NodeMut::PartitionElem(&mut **n as *mut _),
1399 NodeEnum::PartitionSpec(n) => NodeMut::PartitionSpec(n as *mut _),
1400 NodeEnum::PartitionBoundSpec(n) => NodeMut::PartitionBoundSpec(n as *mut _),
1401 NodeEnum::PartitionRangeDatum(n) => NodeMut::PartitionRangeDatum(&mut **n as *mut _),
1402 NodeEnum::PartitionCmd(n) => NodeMut::PartitionCmd(n as *mut _),
1403 NodeEnum::VacuumRelation(n) => NodeMut::VacuumRelation(n as *mut _),
1404 NodeEnum::InlineCodeBlock(n) => NodeMut::InlineCodeBlock(n as *mut _),
1405 NodeEnum::CallContext(n) => NodeMut::CallContext(n as *mut _),
1406 NodeEnum::Integer(n) => NodeMut::Integer(n as *mut _),
1407 NodeEnum::Float(n) => NodeMut::Float(n as *mut _),
1408 NodeEnum::Boolean(n) => NodeMut::Boolean(n as *mut _),
1409 NodeEnum::String(n) => NodeMut::String(n as *mut _),
1410 NodeEnum::BitString(n) => NodeMut::BitString(n as *mut _),
1411 NodeEnum::List(n) => NodeMut::List(n as *mut _),
1412 NodeEnum::IntList(n) => NodeMut::IntList(n as *mut _),
1413 NodeEnum::OidList(n) => NodeMut::OidList(n as *mut _),
1414 NodeEnum::MergeStmt(n) => NodeMut::MergeStmt(&mut **n as *mut _),
1415 NodeEnum::MergeAction(n) => NodeMut::MergeAction(&mut **n as *mut _),
1416 NodeEnum::AlterDatabaseRefreshCollStmt(n) => NodeMut::AlterDatabaseRefreshCollStmt(n as *mut _),
1417 NodeEnum::ReturnStmt(n) => NodeMut::ReturnStmt(&mut **n as *mut _),
1418 NodeEnum::PlassignStmt(n) => NodeMut::PlassignStmt(&mut **n as *mut _),
1419 NodeEnum::StatsElem(n) => NodeMut::StatsElem(&mut **n as *mut _),
1420 NodeEnum::CtesearchClause(n) => NodeMut::CtesearchClause(n as *mut _),
1421 NodeEnum::CtecycleClause(n) => NodeMut::CtecycleClause(&mut **n as *mut _),
1422 NodeEnum::MergeWhenClause(n) => NodeMut::MergeWhenClause(&mut **n as *mut _),
1423 NodeEnum::PublicationObjSpec(n) => NodeMut::PublicationObjSpec(&mut **n as *mut _),
1424 NodeEnum::PublicationTable(n) => NodeMut::PublicationTable(&mut **n as *mut _),
1425 NodeEnum::JsonFormat(n) => NodeMut::JsonFormat(&mut *n as *mut _),
1426 NodeEnum::JsonReturning(n) => NodeMut::JsonReturning(&mut *n as *mut _),
1427 NodeEnum::JsonValueExpr(n) => NodeMut::JsonValueExpr(&mut **n as *mut _),
1428 NodeEnum::JsonConstructorExpr(n) => NodeMut::JsonConstructorExpr(&mut **n as *mut _),
1429 NodeEnum::JsonIsPredicate(n) => NodeMut::JsonIsPredicate(&mut **n as *mut _),
1430 NodeEnum::JsonOutput(n) => NodeMut::JsonOutput(&mut *n as *mut _),
1431 NodeEnum::JsonKeyValue(n) => NodeMut::JsonKeyValue(&mut **n as *mut _),
1432 NodeEnum::JsonObjectConstructor(n) => NodeMut::JsonObjectConstructor(&mut *n as *mut _),
1433 NodeEnum::JsonArrayConstructor(n) => NodeMut::JsonArrayConstructor(&mut *n as *mut _),
1434 NodeEnum::JsonArrayQueryConstructor(n) => NodeMut::JsonArrayQueryConstructor(&mut **n as *mut _),
1435 NodeEnum::JsonAggConstructor(n) => NodeMut::JsonAggConstructor(&mut **n as *mut _),
1436 NodeEnum::JsonObjectAgg(n) => NodeMut::JsonObjectAgg(&mut **n as *mut _),
1437 NodeEnum::JsonArrayAgg(n) => NodeMut::JsonArrayAgg(&mut **n as *mut _),
1438 NodeEnum::RtepermissionInfo(n) => NodeMut::RtepermissionInfo(&mut *n as *mut _),
1439 NodeEnum::WindowFuncRunCondition(n) => NodeMut::WindowFuncRunCondition(&mut **n as *mut _),
1440 NodeEnum::MergeSupportFunc(n) => NodeMut::MergeSupportFunc(&mut **n as *mut _),
1441 NodeEnum::JsonBehavior(n) => NodeMut::JsonBehavior(&mut **n as *mut _),
1442 NodeEnum::JsonExpr(n) => NodeMut::JsonExpr(&mut **n as *mut _),
1443 NodeEnum::JsonTablePath(n) => NodeMut::JsonTablePath(&mut *n as *mut _),
1444 NodeEnum::JsonTablePathScan(n) => NodeMut::JsonTablePathScan(&mut **n as *mut _),
1445 NodeEnum::JsonTableSiblingJoin(n) => NodeMut::JsonTableSiblingJoin(&mut **n as *mut _),
1446 NodeEnum::SinglePartitionSpec(n) => NodeMut::SinglePartitionSpec(&mut *n as *mut _),
1447 NodeEnum::JsonArgument(n) => NodeMut::JsonArgument(&mut **n as *mut _),
1448 NodeEnum::JsonFuncExpr(n) => NodeMut::JsonFuncExpr(&mut **n as *mut _),
1449 NodeEnum::JsonTablePathSpec(n) => NodeMut::JsonTablePathSpec(&mut **n as *mut _),
1450 NodeEnum::JsonTable(n) => NodeMut::JsonTable(&mut **n as *mut _),
1451 NodeEnum::JsonTableColumn(n) => NodeMut::JsonTableColumn(&mut **n as *mut _),
1452 NodeEnum::JsonParseExpr(n) => NodeMut::JsonParseExpr(&mut **n as *mut _),
1453 NodeEnum::JsonScalarExpr(n) => NodeMut::JsonScalarExpr(&mut **n as *mut _),
1454 NodeEnum::JsonSerializeExpr(n) => NodeMut::JsonSerializeExpr(&mut **n as *mut _),
1455 }
1456 }
1457}