pgsql: Fix postgres_fdw's issues with inconsistent interpretation of da - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Fix postgres_fdw's issues with inconsistent interpretation of da
Date
Msg-id E1UFE44-0001ZC-C4@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Fix postgres_fdw's issues with inconsistent interpretation of data values.

For datatypes whose output formatting depends on one or more GUC settings,
we have to worry about whether the other server will interpret the value
the same way it was meant.  pg_dump has been aware of this hazard for a
long time, but postgres_fdw needs to deal with it too.  To fix data
retrieval from the remote server, set the necessary remote GUC settings at
connection startup.  (We were already assuming that settings made then
would persist throughout the remote session.)  To fix data transmission to
the remote server, temporarily force the relevant GUCs to the right values
when we're about to convert any data values to text for transmission.

This is all pretty grotty, and not very cheap either.  It's tempting to
think of defining one uber-GUC that would override any settings that might
render printed data values unportable.  But of course, older remote servers
wouldn't know any such thing and would still need this logic.

While at it, revert commit f7951eef89be78c50ea2241f593d76dfefe176c9, since
this provides a real fix.  (The timestamptz given in the error message
returned from the "remote" server will now reliably be shown in UTC.)

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/cc3f281ffb0a5d9b187e7a7b7de4a045809ff683

Modified Files
--------------
contrib/postgres_fdw/connection.c              |   60 +++++++++++++++-------
contrib/postgres_fdw/deparse.c                 |    6 ++
contrib/postgres_fdw/expected/postgres_fdw.out |   12 ++--
contrib/postgres_fdw/postgres_fdw.c            |   65 +++++++++++++++++++++++-
contrib/postgres_fdw/postgres_fdw.h            |    4 ++
contrib/postgres_fdw/sql/postgres_fdw.sql      |    4 +-
6 files changed, 122 insertions(+), 29 deletions(-)


pgsql-committers by date:

Previous
From: Tom Lane
Date:
Subject: pgsql: Avoid generating bad remote SQL for INSERT ... DEFAULT VALUES.
Next
From: Tom Lane
Date:
Subject: pgsql: Avoid row-processing-order dependency in postgres_fdw regression