On Fri, Apr 22, 2016 at 3:09 PM, Igor Korot <ikorot01 at gmail.com> wrote:

> [code]
> SQLite version 3.9.2 2015-11-02 18:31:45
> Enter ".help" for usage hints.
> sqlite> PRAGMA table_info(leagues);
> 0|id|integer|0||1
> 1|name|varchar(100)|0||0
> 2|drafttype|integer(1)|0||0
> 3|scoringtype|integer(1)|0||0
> 4|roundvalues|integer(1)|0||0
> 5|leaguetype|char(5)|0||0
> sqlite>
> [/code]
>
> The field type is set to be "varchar(100)" for the name field.
> Wouldn't it be more logical to have it as "varchar" and have another field
> for data size?
>

Sometimes there's the precision too, for non-integer numbers, so that would
be two "fields" for type-related "sizes".
Given that SQLite doesn't care about sizes, and has no limits (beside
https://www.sqlite.org/limits.html), it only shows you what you specified
textually I guess.
I'd welcome a size, and precision field too, but I doubt they'd come.

But that brings up another interesting question I never thought about. Is
there a way to determine the type affinity of a column?

PRAGMA table_info obviously doesn't show it. There's typeof() for values,
but what about the actual column's affinity?
There's doc in https://www.sqlite.org/datatype3.html section 2.1, but is
there no actual "programmatic" way to get it?

Thanks, --DD

Reply via email to