postgres_fdw: Disable attribute statistics import from pre-9.1 servers.

To import attribute statistics, postgres_fdw sent a query wity COLLATE
"C" to remote servers without checking their version.  Since COLLATE is
only supported since v9.1, this could break the import against older
servers; fix by modifying postgres_fdw to check their version and if
older, fall back to sampling.  (This commit still allows importing only
relation statistics from such an older server.)

Also, expand the documentation to mention that attribute statistics are
stored into the local server without applying the foreign table columns'
n_distinct option.

Oversight in commit 28972b6fc.

Reported-by: Fujii Masao <[email protected]>
Reported-by: Osama Abdul Qader <[email protected]>
Author: Etsuro Fujita <[email protected]>
Reviewed-by: Corey Huinker <[email protected]>
Discussion: 
https://postgr.es/m/CAHGQGwH8%2BuDTwfohpck9v_9L3nwSWACbmC36JYRyqHd5xQN_OA%40mail.gmail.com
Backpatch-through: 19

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/3ca4abd60ce3661c6ccd3d83a13986ef9541bf40

Modified Files
--------------
contrib/postgres_fdw/postgres_fdw.c | 35 +++++++++++++++++++++++------------
doc/src/sgml/postgres-fdw.sgml      | 11 ++++++-----
2 files changed, 29 insertions(+), 17 deletions(-)

Reply via email to