Re: FDW / list of needed columns, WHERE conditions (in PlanForeignScan) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: FDW / list of needed columns, WHERE conditions (in PlanForeignScan)
Date
Msg-id 17388.1338350512@sss.pgh.pa.us
Whole thread Raw
In response to Re: FDW / list of needed columns, WHERE conditions (in PlanForeignScan)  (Tomas Vondra <tv@fuzzy.cz>)
List pgsql-hackers
Tomas Vondra <tv@fuzzy.cz> writes:
> Do I need to return only the data in rel->reltargetlist, or should I
> return all the columns (including those in rel->baserestrictinfo)?

> Because AFAIK PostgreSQL will recheck the conditions on the data
> returned from FDW and if I only return the attributes from the
> reltargetlist, the conditions will evaluate to FALSE. Can I prevent the
> recheck somehow e.g. by deleting it from baserestrictinfo?

In 9.1, the FDW doesn't have any control over that, so yeah you have to
include all those columns in the constructed scan tuples.  We rejiggered
this in 9.2 so that the FDW could control which baserestrictinfo quals
are evaluated that way.  (Of course, it's up to you to be sure you do
somehow check any conditions you remove from the qual list.)

> Also, how is baserestrictinfo related to PlanState.quals? Actually what
> are 'qual conditions'? I see 'qual' is a list of conditions connected by
> AND, but I'm not sure what a 'qual' means. Is that equality?

It's just planner slang for a WHERE condition.  The List structure
corresponds to top-level AND structure in WHERE, but otherwise the
elements correspond directly to WHERE expressions.
        regards, tom lane


pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: hash index concurrency
Next
From: Tom Lane
Date:
Subject: Re: hash index concurrency