On 2015/09/29 16:36, Etsuro Fujita wrote:
For the foreign table case (scanrelid>0), I imagined an approach different than yours. In that case, I thought the issue would be probably addressed by just modifying the remote query performed in RefetchForeignRow, which would be of the form "SELECT ctid, * FROM remote table WHERE ctid = $1", so that the modified query would be of the form "SELECT ctid, * FROM remote table WHERE ctid = $1 AND *remote quals*".
Sorry, I was wrong. I noticed that the modifieid query (that will be sent to the remote server during postgresRefetchForeignRow) should be of the form "SELECT * FROM (SELECT ctid, * FROM remote table WHERE ctid = $1) ss WHERE *remote quals*". (I think the query of the form "SELECT ctid, * FROM remote table WHERE ctid = $1 AND *remote quals*" would be okay if using a TID scan on the remote side, though.)
Best regards, Etsuro Fujita -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers