SERIAL types in a table hierarchy
CREATE ROW TYPE parent_t (a INT);
CREATE ROW TYPE child1_t (s_col SERIAL) UNDER parent_t;
CREATE ROW TYPE child2_t (s8_col SERIAL8) UNDER child1_t;
CREATE ROW TYPE child3_t (d FLOAT) UNDER child2_t;
CREATE TABLE parent_tab of type parent_t;
CREATE TABLE child1_tab of type child1_t UNDER parent_tab;
CREATE TABLE child2_tab of type child2_t UNDER child1_tab;
CREATE TABLE child3_tab of type child3_t UNDER child2_tab;
The parent_tab table does not contain a SERIAL type. The child1_tab introduces a SERIAL counter into the hierarchy. The child2_tab inherits the SERIAL column from child1_tab and adds a SERIAL8 column. The child3_tab inherits both a SERIAL and SERIAL8 column.
A 0 value inserted into the s_col or s8_col column for any table in the hierarchy inserts a monotonically increasing value, regardless of which table takes the insert.
ALTER TABLE child3_tab
MODIFY (s_col SERIAL(100), s8_col SERIAL8 (200))
Except for the previously described behavior, all the rules that apply to SERIAL, BIGSERIAL, and SERIAL8 type columns in untyped tables also apply to SERIAL, BIGSERIAL, and SERIAL8 type columns in table hierarchies. For more information, see Select data types and the HCL OneDB™ Guide to SQL: Reference.