Hello, > It is just my personal opinion, but I think it would be convenient for > users to alter inheritance trees that contain foreign tables the same > way as inheritance trees that don't contain any foreign tables, > without making user conscious of the inheritance trees contains > foreign tables or not. Imagine we have an inheritance tree that > contains only plain tables and then add a foreign table as a child of > the inheritance tree. Without the flexiblity, we would need to change > the way of altering the structure of the inheritance tree (e.g., ADD > CONSTRAINT) to a totally different one, immediately when adding the > foreign table. I don't think that would be easy to use.
I personally don't see significant advantages such a flexibility. Although my concerns here are only two points, unanticipated application and "maintenancibility". I gave a consideration on these issues again. Then, I think it could be enough by giving feedback to operators for the first issue. =# ALTER TABLE parent ADD CHECK (tempmin < tempmax), ALTER tempmin SET NOT NULL, ALTER tempmin SET DEFAULT 0; NOTICE: Child foregn table child01 is affected. NOTICE: Child foregn table child02 is affected NOTICE: Child foregn table child03 rejected 'alter tempmin set default' What do you think about this? It looks a bit too loud for me though... Then the second issue, however I don't have enough idea of how ALTER TABLE works, the complexity would be reduced if acceptance chek for alter "action"s would done on foreign server or data wrapper side, not on the core of ALTER TABLE. It would also be a help to output error messages like above. However, (NO)INHERIT looks a little different.. > > http://www.postgresql.org/docs/9.3/static/sql-alterforeigntable.html > > > >> Consistency with the foreign server is not checked when a > >> column is added or removed with ADD COLUMN or DROP COLUMN, a > >> NOT NULL constraint is added, or a column type is changed with > >> SET DATA TYPE. It is the user's responsibility to ensure that > >> the table definition matches the remote side. > > > > So I belive implicit and automatic application of any constraint > > on foreign childs are considerably danger. > > We spent a lot of time discussing this issue, and the consensus is > that it's users' fault if there are some tuples on the remote side > violating a given constraint, as mentioned in the documentation. I'm worried about not that but the changes and possible inconsistency would take place behind operators' backs. And this looks to cause such inconsistencies for me. > >> * [NO] INHERIT parent_table > > > > Is this usable for inheritance foreign children? NO INHERIT > > removes all foreign children but INHERIT is nop. > > I didn't express clearly. Sorry for that. Let me explain about it. > > * ALTER FOREIGN TABLE target_table *INHERIT* parent_table: Add the > * target table as a new child of the parent table. > * ALTER FOREIGN TABLE target_table *NO INHERIT* parent_table: Remove the > * target table from the list of children of the parent table. I got it, thank you. It alone seems no probmen but also doesn't seem to be a matter of 'ALTER TABLE'. Could you tell me how this is related to 'ALTER TABLE'? regards, -- Kyotaro Horiguchi NTT Open Source Software Center -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers