[9.3] Automatically updatable views vs writable foreign tables - Mailing list pgsql-hackers

From Dean Rasheed
Subject [9.3] Automatically updatable views vs writable foreign tables
Date
Msg-id CAEZATCXi3yYomexaQqPapF++oBc4i-GwUD_hB4aAVbU4eGkA7Q@mail.gmail.com
Whole thread Raw
Responses Re: [9.3] Automatically updatable views vs writable foreign tables
List pgsql-hackers
Hi,

I've just started 9.3 beta testing and I noticed that a "simple" view
defined on top of a writable foreign table is not automatically
updatable.

Given that these are both new-to-9.3 features, I think it would be a
shame if they don't work together. It's basically a 1-line patch to
make such views automatically updatable, plus a small extra code block
in relation_is_updatable() to reflect the change in the
information_schema views.

The attached patch does that and adds a couple of extra regression tests.


The tests, however, reveal a separate issue with writable foreign
tables --- the information_schema views haven't been updated to
reflect the fact that foreign tables may now be updatable.
Specifically, for foreign tables
information_schema.tables.is_insertable_into and
information_schema.columns.is_updatable always say 'NO' even if the
foreign table is writable. Fixing that would require new C functions
along the same lines as pg_view_is_insertable/updatable(), or those
functions could just be renamed and repurposed to do the check for all
relation kinds, except those known to be always/never updatable.

Regards,
Dean

Attachment

pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Better handling of archive_command problems
Next
From: Tom Lane
Date:
Subject: Re: [9.3] Automatically updatable views vs writable foreign tables