Tom Lane wrote:
> Hmm. This looks like a CREATE TABLE implicitly creates a datatype
> that acts more or less like a C 'struct' declaration, ie, it's just a
> collection of subfields. OK, a struct-making declaration is certainly
> useful. What I don't understand yet is whether the contents of table
> "address" have any connection to the data stored in table "person".
> If not, why must I create a table in order to define a datatype? Seems
> like a separate CREATE DATATYPE command would make more sense...
I think the idea is like in C++ if you create a
class Address {
...
}
and a class
class Person {Address address;
}
Then you can create both standalone Addresses as well as addresses
embedded
inside the Person.
CREATE DATATYPE might be a thought, but it's probably not very
essential.