Improve updatability checking for views and foreign tables.
Tom Lane <tgl@sss.pgh.pa.us>
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
Files
| Path | Change | +/− |
|---|---|---|
| contrib/postgres_fdw/expected/postgres_fdw.out | modified | +1 −0 |
| contrib/postgres_fdw/option.c | modified | +6 −2 |
| contrib/postgres_fdw/postgres_fdw.c | modified | +47 −0 |
| contrib/postgres_fdw/sql/postgres_fdw.sql | modified | +1 −0 |
| doc/src/sgml/fdwhandler.sgml | modified | +27 −0 |
| doc/src/sgml/postgres-fdw.sgml | modified | +37 −0 |
| src/backend/catalog/information_schema.sql | modified | +11 −4 |
| src/backend/executor/execMain.c | modified | +18 −0 |
| src/backend/rewrite/rewriteHandler.c | modified | +78 −24 |
| src/backend/utils/adt/misc.c | modified | +35 −16 |
| src/include/catalog/catversion.h | modified | +1 −1 |
| src/include/catalog/pg_proc.h | modified | +4 −4 |
| src/include/foreign/fdwapi.h | modified | +3 −0 |
| src/include/rewrite/rewriteHandler.h | modified | +1 −1 |
| src/include/utils/builtins.h | modified | +2 −2 |