Peter Otten wrote:
> Clemens Ladisch wrote:
>> Peter Otten wrote:
>>> Clemens Ladisch wrote:
>>>> The first query uses a temporary table for sorting.  The column in that
>>>> temporary table does not have a declared type.
>>>>
>>>> The second query returns the values directly from the underlying table
>>>> column, so the declared type is also from that table.
>>>
>>> Thank you. Is there a way around that limitation?
>>
>> Which of these two cases do you think is the result of a limitation?
>
> Losing type information. I think it should be possible to infer the column
> type in a subquery (but have no idea yet how hard that would be). Given
>
> select * from (select alpha from demo union all select alpha from demo) order 
> by alpha
>
> the alpha column in both parts of the union has the same type ("custom").
> Therefore the resulting column in the outer select could safely be assumed
> to be of type "custom", too.

By design, SQLite uses dynamic typing, and keeps only the actual type of
the value.  The declared type is a property of the *column*, not of the
value itself, so it is lost as soon as the value is no longer associated
directly with the table.


Regards,
Clemens
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to