citusdata / citus

Distributed PostgreSQL as an extension
https://www.citusdata.com
GNU Affero General Public License v3.0
10.34k stars 656 forks source link

Support table inheritance #5277

Open Renatov opened 2 years ago

Renatov commented 2 years ago

CREATE TABLE cities ( name text, population real, elevation int -- (in ft) );

CREATE TABLE capitals ( state char(2) UNIQUE NOT NULL ) INHERITS (cities);

SELECT create_reference_table('capitals');

Error message: capitals is not a regular, foreign or partitioned table

onurctirtir commented 2 years ago

Hi @Renatov, Yes, unfortunately, this is not supported at the moment, so let me put "feature" label to track this one as a feature request. Also, to better understand your usecase, is it a blocker for you to use citus ?

Renatov commented 2 years ago

Thank you! If it is limiting to use citus, since I want to use the extension in a database structure already made, and that has data, so if I must delete the inherited tables and see some alternative that compensates me for the use of inherited tables (It is start from scratch and be able to lose data), seeing all the alternative to replace the inheritance of tables in postgres there is no one that can supplant this function, for which you see it very necessary to be able to extend to citus, again thank you very much

steven-sheehy commented 2 years ago

This feature is important for us as well. We have a lot of tables that share common fields but have some extra fields for the children. We also have history tables for these tables so it's not practical to use a shared table for the parent fields.

We're working around it now by using separate tables but that makes the queries that need to query all with UNION complex. And using UNION in a view to fake inherited queries doesn't properly push down operators like LIMIT, requiring full table scans.