Details
-
Improvement
-
Status: Open
-
Major
-
Resolution: Unresolved
-
0.9.9
Description
Suppose you had the following CREATE TYPE statement:
CREATE TYPE productsType AS
{ itemno: int, category: string, name: string, descrip: string?, manuf: string, listprice: int };
If for some (perhaps ill-advised) reason you wanted to permit the listprice field to be either an int or a string, we have no way to express that at present. We need a notation that addresses that! E.g., something along the following lines (final syntax TBD):
CREATE TYPE productsType AS
{ itemno: int, category: string, name: string, descrip: string?, manuf: string, listprice: int | string };
Note that internally the schema inference under our columnar format can represent this, there's just no way to say it at the user level. Note that we'd also have to extend the check-before-deposit logic in INSERT and UPSERT to enforce these sorts of more general type constraints - not sure if it would "just work" or if it's significant new code (since I haven't looked at that part of the code base).