Re: postgres_fdw: using TABLESAMPLE to collect remote sample - Mailing list pgsql-hackers

From Tom Lane
Subject Re: postgres_fdw: using TABLESAMPLE to collect remote sample
Date
Msg-id 2082308.1644602761@sss.pgh.pa.us
Whole thread Raw
In response to Re: postgres_fdw: using TABLESAMPLE to collect remote sample  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: postgres_fdw: using TABLESAMPLE to collect remote sample
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> I think it's going to be necessary to compromise on that at some
> point.

Sure.  The existing postgres_fdw documentation [1] already addresses
this issue:

    postgres_fdw can be used with remote servers dating back to PostgreSQL
    8.3. Read-only capability is available back to 8.1. A limitation
    however is that postgres_fdw generally assumes that immutable built-in
    functions and operators are safe to send to the remote server for
    execution, if they appear in a WHERE clause for a foreign table. Thus,
    a built-in function that was added since the remote server's release
    might be sent to it for execution, resulting in “function does not
    exist” or a similar error. This type of failure can be worked around
    by rewriting the query, for example by embedding the foreign table
    reference in a sub-SELECT with OFFSET 0 as an optimization fence, and
    placing the problematic function or operator outside the sub-SELECT.

While I'm not opposed to moving those goalposts at some point,
I think pushing them all the way up to 9.5 for this one easily-fixed
problem is not very reasonable.

Given other recent discussion, an argument could be made for moving
the cutoff to 9.2, on the grounds that it's too hard to test against
anything older.  But that still leaves us needing a version check
if we want to use TABLESAMPLE.

            regards, tom lane

[1] https://www.postgresql.org/docs/devel/postgres-fdw.html#id-1.11.7.45.17



pgsql-hackers by date:

Previous
From: Nathan Bossart
Date:
Subject: Re: O(n) tasks cause lengthy startups and checkpoints
Next
From: Robert Haas
Date:
Subject: Re: postgres_fdw: using TABLESAMPLE to collect remote sample