Re: postgres_fdw: Handle boolean comparison predicates - Mailing list pgsql-hackers

From Cary Huang
Subject Re: postgres_fdw: Handle boolean comparison predicates
Date
Msg-id 162948799238.22084.17682262819167731211.pgcf@coridan.postgresql.org
Whole thread Raw
In response to Re: postgres_fdw: Handle boolean comparison predicates  (Ronan Dunklau <ronan.dunklau@aiven.io>)
Responses Re: postgres_fdw: Handle boolean comparison predicates  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
The following review has been posted through the commitfest application:
make installcheck-world:  tested, passed
Implements feature:       tested, passed
Spec compliant:           tested, passed
Documentation:            not tested

Hello

I tried to apply the patch to master branch and got a couple of errors, so I think the patch needs a rebase. 

I also agree with Ashutosh that the "IS NOT TRUE" case can be simplified to just "IS FALSE". it's simpler to
understand.

based on this, I think we should restructure the switch-case statement in deparseBooleanTest because some of the cases
inthere evaluate to the same result but handles differently. 
 

For example, "IS TRUE" and "IS NOT FALSE" both evaluate to true, so can be handled in the same way

something like:
switch (node->booltesttype)
{
    case IS_TRUE:
    case IS_NOT_FALSE:
        appendStringInfoChar(buf, '(');
        deparseExpr(node->arg, context);
        appendStringInfoString(buf, ")");
        break;
    case IS_FALSE:
    case IS_NOT_TRUE:
        appendStringInfoChar(buf, '(');
        deparseExpr(node->arg, context);
        appendStringInfoString(buf, " IS FALSE)");
        break;
    case IS_UNKNOWN:
        appendStringInfoChar(buf, '(');
        deparseExpr(node->arg, context);
        appendStringInfoString(buf, " IS NULL)");
        break;
    case IS_NOT_UNKNOWN:
        appendStringInfoChar(buf, '(');
        deparseExpr(node->arg, context);
        appendStringInfoString(buf, " IS NOT NULL)");
        break;
}

just a thought
thanks!

-------------------------------
Cary Huang
HighGo Software Canada
www.highgo.ca

pgsql-hackers by date:

Previous
From: Tomas Vondra
Date:
Subject: Re: Use extended statistics to estimate (Var op Var) clauses
Next
From: Peter Geoghegan
Date:
Subject: Re: The Free Space Map: Problems and Opportunities