Skip to content

Commit 126b061

Browse files
author
Rafa de la Torre
committed
Remove uneeded warnings
1 parent d286c3c commit 126b061

File tree

1 file changed

+25
-79
lines changed

1 file changed

+25
-79
lines changed

contrib/postgres_fdw/deparse.c

Lines changed: 25 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -340,10 +340,8 @@ foreign_expr_walker(Node *node,
340340
*/
341341
if (var->varattno < 0 &&
342342
var->varattno != SelfItemPointerAttributeNumber &&
343-
var->varattno != ObjectIdAttributeNumber) {
344-
elog(WARNING, "RTORRE return false 1");
343+
var->varattno != ObjectIdAttributeNumber)
345344
return false;
346-
}
347345

348346
/* Else check the collation */
349347
collation = var->varcollid;
@@ -411,31 +409,23 @@ foreign_expr_walker(Node *node,
411409
ArrayRef *ar = (ArrayRef *) node;
412410

413411
/* Assignment should not be in restrictions. */
414-
if (ar->refassgnexpr != NULL) {
415-
elog(WARNING, "RTORRE return false 2");
412+
if (ar->refassgnexpr != NULL)
416413
return false;
417-
}
418414

419415
/*
420416
* Recurse to remaining subexpressions. Since the array
421417
* subscripts must yield (noncollatable) integers, they won't
422418
* affect the inner_cxt state.
423419
*/
424420
if (!foreign_expr_walker((Node *) ar->refupperindexpr,
425-
glob_cxt, &inner_cxt)) {
426-
elog(WARNING, "RTORRE return false 3");
421+
glob_cxt, &inner_cxt))
427422
return false;
428-
}
429423
if (!foreign_expr_walker((Node *) ar->reflowerindexpr,
430-
glob_cxt, &inner_cxt)) {
431-
elog(WARNING, "RTORRE return false 4");
424+
glob_cxt, &inner_cxt))
432425
return false;
433-
}
434426
if (!foreign_expr_walker((Node *) ar->refexpr,
435427
glob_cxt, &inner_cxt))
436-
elog(WARNING, "RTORRE return false 5"); {
437428
return false;
438-
}
439429

440430
/*
441431
* Array subscripting should yield same collation as input,
@@ -462,19 +452,15 @@ foreign_expr_walker(Node *node,
462452
* can't be sent to remote because it might have incompatible
463453
* semantics on remote side.
464454
*/
465-
if (!is_shippable(fe->funcid, ProcedureRelationId, fpinfo)) {
466-
elog(WARNING, "RTORRE return false 6");
455+
if (!is_shippable(fe->funcid, ProcedureRelationId, fpinfo))
467456
return false;
468-
}
469457

470458
/*
471459
* Recurse to input subexpressions.
472460
*/
473461
if (!foreign_expr_walker((Node *) fe->args,
474-
glob_cxt, &inner_cxt)) {
475-
elog(WARNING, "RTORRE return false 7");
462+
glob_cxt, &inner_cxt))
476463
return false;
477-
}
478464

479465
/*
480466
* If function's input collation is not derived from a foreign
@@ -483,10 +469,8 @@ foreign_expr_walker(Node *node,
483469
if (fe->inputcollid == InvalidOid)
484470
/* OK, inputs are all noncollatable */ ;
485471
else if (inner_cxt.state != FDW_COLLATE_SAFE ||
486-
fe->inputcollid != inner_cxt.collation) {
487-
elog(WARNING, "RTORRE return false 8");
472+
fe->inputcollid != inner_cxt.collation)
488473
return false;
489-
}
490474

491475
/*
492476
* Detect whether node is introducing a collation not derived
@@ -516,19 +500,15 @@ foreign_expr_walker(Node *node,
516500
* (If the operator is shippable, we assume its underlying
517501
* function is too.)
518502
*/
519-
if (!is_shippable(oe->opno, OperatorRelationId, fpinfo)) {
520-
elog(WARNING, "RTORRE return false 9");
503+
if (!is_shippable(oe->opno, OperatorRelationId, fpinfo))
521504
return false;
522-
}
523505

524506
/*
525507
* Recurse to input subexpressions.
526508
*/
527509
if (!foreign_expr_walker((Node *) oe->args,
528-
glob_cxt, &inner_cxt)) {
529-
elog(WARNING, "RTORRE return false 10");
510+
glob_cxt, &inner_cxt))
530511
return false;
531-
}
532512

533513
/*
534514
* If operator's input collation is not derived from a foreign
@@ -537,10 +517,8 @@ foreign_expr_walker(Node *node,
537517
if (oe->inputcollid == InvalidOid)
538518
/* OK, inputs are all noncollatable */ ;
539519
else if (inner_cxt.state != FDW_COLLATE_SAFE ||
540-
oe->inputcollid != inner_cxt.collation) {
541-
elog(WARNING, "RTORRE return false 11");
520+
oe->inputcollid != inner_cxt.collation)
542521
return false;
543-
}
544522

545523
/* Result-collation handling is same as for functions */
546524
collation = oe->opcollid;
@@ -562,19 +540,15 @@ foreign_expr_walker(Node *node,
562540
/*
563541
* Again, only shippable operators can be sent to remote.
564542
*/
565-
if (!is_shippable(oe->opno, OperatorRelationId, fpinfo)) {
566-
elog(WARNING, "RTORRE return false 12");
543+
if (!is_shippable(oe->opno, OperatorRelationId, fpinfo))
567544
return false;
568-
}
569545

570546
/*
571547
* Recurse to input subexpressions.
572548
*/
573549
if (!foreign_expr_walker((Node *) oe->args,
574-
glob_cxt, &inner_cxt)) {
575-
elog(WARNING, "RTORRE return false 13");
550+
glob_cxt, &inner_cxt))
576551
return false;
577-
}
578552

579553
/*
580554
* If operator's input collation is not derived from a foreign
@@ -583,10 +557,8 @@ foreign_expr_walker(Node *node,
583557
if (oe->inputcollid == InvalidOid)
584558
/* OK, inputs are all noncollatable */ ;
585559
else if (inner_cxt.state != FDW_COLLATE_SAFE ||
586-
oe->inputcollid != inner_cxt.collation) {
587-
elog(WARNING, "RTORRE return false 14");
560+
oe->inputcollid != inner_cxt.collation)
588561
return false;
589-
}
590562

591563
/* Output is always boolean and so noncollatable. */
592564
collation = InvalidOid;
@@ -601,10 +573,8 @@ foreign_expr_walker(Node *node,
601573
* Recurse to input subexpression.
602574
*/
603575
if (!foreign_expr_walker((Node *) r->arg,
604-
glob_cxt, &inner_cxt)) {
605-
elog(WARNING, "RTORRE return false 15");
576+
glob_cxt, &inner_cxt))
606577
return false;
607-
}
608578

609579
/*
610580
* RelabelType must not introduce a collation not derived from
@@ -630,10 +600,8 @@ foreign_expr_walker(Node *node,
630600
* Recurse to input subexpressions.
631601
*/
632602
if (!foreign_expr_walker((Node *) b->args,
633-
glob_cxt, &inner_cxt)) {
634-
elog(WARNING, "RTORRE return false 16");
603+
glob_cxt, &inner_cxt))
635604
return false;
636-
}
637605

638606
/* Output is always boolean and so noncollatable. */
639607
collation = InvalidOid;
@@ -648,10 +616,8 @@ foreign_expr_walker(Node *node,
648616
* Recurse to input subexpressions.
649617
*/
650618
if (!foreign_expr_walker((Node *) nt->arg,
651-
glob_cxt, &inner_cxt)) {
652-
elog(WARNING, "RTORRE return false 17");
619+
glob_cxt, &inner_cxt))
653620
return false;
654-
}
655621

656622
/* Output is always boolean and so noncollatable. */
657623
collation = InvalidOid;
@@ -666,10 +632,8 @@ foreign_expr_walker(Node *node,
666632
* Recurse to input subexpressions.
667633
*/
668634
if (!foreign_expr_walker((Node *) a->elements,
669-
glob_cxt, &inner_cxt)) {
670-
elog(WARNING, "RTORRE return false 18");
635+
glob_cxt, &inner_cxt))
671636
return false;
672-
}
673637

674638
/*
675639
* ArrayExpr must not introduce a collation not derived from
@@ -698,10 +662,8 @@ foreign_expr_walker(Node *node,
698662
foreach(lc, l)
699663
{
700664
if (!foreign_expr_walker((Node *) lfirst(lc),
701-
glob_cxt, &inner_cxt)) {
702-
elog(WARNING, "RTORRE return false 19");
665+
glob_cxt, &inner_cxt))
703666
return false;
704-
}
705667
}
706668

707669
/*
@@ -721,22 +683,16 @@ foreign_expr_walker(Node *node,
721683
ListCell *lc;
722684

723685
/* Not safe to pushdown when not in grouping context */
724-
if (!IS_UPPER_REL(glob_cxt->foreignrel)) {
725-
elog(WARNING, "RTORRE return false 20");
686+
if (!IS_UPPER_REL(glob_cxt->foreignrel))
726687
return false;
727-
}
728688

729689
/* Only non-split aggregates are pushable. */
730-
if (agg->aggsplit != AGGSPLIT_SIMPLE) {
731-
elog(WARNING, "RTORRE return false 21");
690+
if (agg->aggsplit != AGGSPLIT_SIMPLE)
732691
return false;
733-
}
734692

735693
/* As usual, it must be shippable. */
736-
if (!is_shippable(agg->aggfnoid, ProcedureRelationId, fpinfo)) {
737-
elog(WARNING, "RTORRE return false 22");
694+
if (!is_shippable(agg->aggfnoid, ProcedureRelationId, fpinfo))
738695
return false;
739-
}
740696

741697
/*
742698
* Recurse to input args. aggdirectargs, aggorder and
@@ -755,10 +711,8 @@ foreign_expr_walker(Node *node,
755711
n = (Node *) tle->expr;
756712
}
757713

758-
if (!foreign_expr_walker(n, glob_cxt, &inner_cxt)) {
759-
elog(WARNING, "RTORRE return false 23");
714+
if (!foreign_expr_walker(n, glob_cxt, &inner_cxt))
760715
return false;
761-
}
762716
}
763717

764718
/*
@@ -785,19 +739,15 @@ foreign_expr_walker(Node *node,
785739
if (srt->sortop != typentry->lt_opr &&
786740
srt->sortop != typentry->gt_opr &&
787741
!is_shippable(srt->sortop, OperatorRelationId,
788-
fpinfo)) {
789-
elog(WARNING, "RTORRE return false 24");
742+
fpinfo))
790743
return false;
791-
}
792744
}
793745
}
794746

795747
/* Check aggregate filter */
796748
if (!foreign_expr_walker((Node *) agg->aggfilter,
797-
glob_cxt, &inner_cxt)) {
798-
elog(WARNING, "RTORRE return false 25");
749+
glob_cxt, &inner_cxt))
799750
return false;
800-
}
801751

802752
/*
803753
* If aggregate's input collation is not derived from a
@@ -806,10 +756,8 @@ foreign_expr_walker(Node *node,
806756
if (agg->inputcollid == InvalidOid || inner_cxt.state == FDW_COLLATE_NONE)
807757
/* OK, inputs are all noncollatable */ ;
808758
else if (inner_cxt.state != FDW_COLLATE_SAFE ||
809-
agg->inputcollid != inner_cxt.collation) {
810-
elog(WARNING, "RTORRE return false 26");
759+
agg->inputcollid != inner_cxt.collation)
811760
return false;
812-
}
813761

814762
/*
815763
* Detect whether node is introducing a collation not derived
@@ -835,15 +783,13 @@ foreign_expr_walker(Node *node,
835783
* cover the st_asmvt(ROW(st_asmvtgeom(...)) case. I guess the
836784
* proper solution is to examine the row expression carefully.
837785
*/
838-
ereport(WARNING, (errmsg_internal("RTORRE in a T_RowExpr")));
839786
return true;
840787
default:
841788

842789
/*
843790
* If it's anything else, assume it's unsafe. This list can be
844791
* expanded later, but don't forget to add deparse support below.
845792
*/
846-
elog(WARNING, "RTORRE unrecognized node type: %d", (int) nodeTag(node));
847793
return false;
848794
}
849795

0 commit comments

Comments
 (0)