Thread: pgsql: Improve updatability checking for views and foreign tables.

pgsql: Improve updatability checking for views and foreign tables.

From
Tom Lane
Date:
Improve updatability checking for views and foreign tables.

Extend the FDW API (which we already changed for 9.3) so that an FDW can
report whether specific foreign tables are insertable/updatable/deletable.
The default assumption continues to be that they're updatable if the
relevant executor callback function is supplied by the FDW, but finer
granularity is now possible.  As a test case, add an "updatable" option to
contrib/postgres_fdw.

This patch also fixes the information_schema views, which previously did
not think that foreign tables were ever updatable, and fixes
view_is_auto_updatable() so that a view on a foreign table can be
auto-updatable.

initdb forced due to changes in information_schema views and the functions
they rely on.  This is a bit unfortunate to do post-beta1, but if we don't
change this now then we'll have another API break for FDWs when we do
change it.

Dean Rasheed, somewhat editorialized on by Tom Lane

Branch
------
master

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

Modified Files
--------------
contrib/postgres_fdw/expected/postgres_fdw.out |    1 +
contrib/postgres_fdw/option.c                  |    8 +-
contrib/postgres_fdw/postgres_fdw.c            |   47 +++++++++++
contrib/postgres_fdw/sql/postgres_fdw.sql      |    1 +
doc/src/sgml/fdwhandler.sgml                   |   27 +++++++
doc/src/sgml/postgres-fdw.sgml                 |   37 +++++++++
src/backend/catalog/information_schema.sql     |   15 +++-
src/backend/executor/execMain.c                |   18 +++++
src/backend/rewrite/rewriteHandler.c           |  102 ++++++++++++++++++------
src/backend/utils/adt/misc.c                   |   51 ++++++++----
src/include/catalog/catversion.h               |    2 +-
src/include/catalog/pg_proc.h                  |    8 +-
src/include/foreign/fdwapi.h                   |    3 +
src/include/rewrite/rewriteHandler.h           |    2 +-
src/include/utils/builtins.h                   |    4 +-
15 files changed, 272 insertions(+), 54 deletions(-)