Database Reference
In-Depth Information
Assigning a user-defined type to a column
Since the
education_information
type is designed to play the same role as the tuple
used in our existing
education
column, let's drop the tuple column and replace it with
the more semantic user-defined type:
ALTER TABLE "users" DROP "education";
ALTER TABLE "users"
ADD "education" frozen <"education_information">;
Observe that, as with tuples, we must use the
frozen
keyword when creating columns
with user-defined types. As earlier, this makes explicit the fact that an
educa-
tion_information
value is unitary, despite having an internal structure comprising
multiple fields.