Stefan Keller wrote: > Thank you, Tom and Dan, for your constructive answers. > > To Pavel: My application reads the column types out in order to pretty > print the values - as mentioned by Tom - but also to generate a dialog > for entering new data (of course combined with INSTEAD OF TRIGGERs). > > I understand that it's difficult to implement result-types for > expressions in general. To me it would be enough if there would be at > least one way to assign result-types with a CAST "wrapper" as I have > mentioned before. > > Does anybody know whom to present this proposal in order remedy this > current inconsistency in SQLite? sqlite-dev? > Actually, I'd say that the inconsistency is that views have declared types at all. Declared types determine type affinity, which determines what happens when you put data in a column. But SQLite doesn't have updatable views, so typed columns don't *do* anything on them.
>>> but you'd have to do it for operators as well, and what type should A * B >>> be if A is "SMALLINT" and B is "UINT"? >>> >> I hadn't thought of operators. As far as I know, mathematical operators (* / >> + -) only work with integers and reals, Perhaps the result type could be set >> to "numeric" or some other superclass. Or, to get real fancy, if the two >> operands are declared integers, then the result is an integer; if one is >> real then the result is real. AFAIK SMALLINT and UINT are both treated by >> SQLite as integer, so the result would be an integer. >> There would be 3 (or 4) cases to deal with: * String concatenation (||) returns TEXT. * Arithmetic operators (+ - * / %) return NUMERIC. * Bit operators (<< >> & | ~) return INTEGER. (BTW, why is there no XOR?) * Relational and logical operators return INTEGER, but you may want to distinguish them with a BOOLEAN type name. _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users