1

I have 2 SQL tables say all_cities, regular_cities, (and capitol_cities).

all_cities has 2 columns : name, population regular_cities has 2 columns : name, population capitol_cities has 3 columns : name, population, state

These tables are already created. I want to connect them using table partitioning but first I need to make sure that tables regular_cities and capitol_cities inherit from all_cities.

Is there anyway to have these tables inherit from another table even after the tables are created or only when creating a new table?

Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189
Ely Fialkoff
  • 642
  • 1
  • 5
  • 12

1 Answers1

1

After searching around the correct way to do this is with a simple ALTER statement ALTER TABLE <child_table> INHERIT <parent_table>; That's it!

Documentation here https://www.postgresql.org/docs/9.6/static/sql-altertable.html

Ely Fialkoff
  • 642
  • 1
  • 5
  • 12