Re: Object Class and Data Type

From: Laconic2 <>
Date: Fri, 2 Apr 2004 13:31:05 -0500
Message-ID: <>

I think user defined types fit in to the model somewhere.

Consider the two definitions:

create domain zip_code char(5);
create domain product_code char(5);

(I apologize for using char(5), but that's beside the point.)

The point is that they are two different domains, that happen to have a common format, and maybe overlapping representations. But the they are different domains.

now in some join clause, I see

"where customer.zip_code = oder_item.product_code", then something is wrong
(assuming that each column is derived from its namesake).

It isn't going to take a rocket scientist to figure out that the query is comparing apples and oranges. Just a computer scientist.

In fact, if every table column is defined with reference to a user defined domain, and if objects from different domains are always different objects, even if they are homonyms, it's possible to scan the code for bugs of this type automatically. I've done it, and I've found bugs this way.

However, now consider:

create domain string5 char(5);

and both zip codes and product codes are assigned to the same domain because of their common format. Something has been lost in the description. I've seen this type of domain definition, and, IMO, it's a squandering of power.

Now, my question: does the addition of "create domain" add to the DDL expressiveness of SQL, and is the addition important? Received on Fri Apr 02 2004 - 20:31:05 CEST

Original text of this message