concept inheritance in category postgis

This is an excerpt from Manning's book PostGIS in Action, Third Edition.
In this section, we’ll cover four common ways to organize data in a spatial database: heterogeneous spatial columns, homogeneous spatial columns, partitioning, and inheritance. We’ll explain how you’d go about setting up your database structure using each of these approaches and point out the advantages and disadvantages of each. These approaches are by no means exhaustive, and you should feel free to find your own hybrid that fits your specific needs. We’ll also mainly focus on geometry data types over any of the other spatial types. Geometry data types are by far the predominant data types in PostGIS, and they’re the foundation for topology and raster data types. Finally, geometry types are inherently faster for most spatial computations than the other types in the spatial family. All this may change as the other spatial types mature, but you’ll find the general concepts we cover in this section to be applicable to other spatial types too.
Listing 14.1. Code to partition roads into various states by inheritance
CREATE TABLE ch14.roads( gid integer GENERATED BY DEFAULT AS IDENTITY, #1 road_name character varying(100), geom geometry(LINESTRING,4269), state varchar(2), CONSTRAINT pk_roads PRIMARY KEY (gid) ); CREATE TABLE ch14.roads_NE (CONSTRAINT pk_roads_ne PRIMARY KEY (gid)) #2 INHERITS (ch14.roads); ALTER TABLE ch14.roads_NE ADD CONSTRAINT chk CHECK (state IN ('MA','ME','NH','VT','CT','RI')); #3 CREATE TABLE ch14.roads_SW (CONSTRAINT pk_roads_sw PRIMARY KEY (gid)) INHERITS (ch14.roads); ALTER TABLE ch14.roads_SW ADD CONSTRAINT chk CHECK (state IN ('AZ','NM','NV')); SELECT gid, road_name, geom FROM ch14.roads WHERE state = 'MA'; #4