Re: VTable Column Affinity Question and Change Request

Jens Alfke <jens-mAcipnqRhZf2eFz/[email protected]>
Newsgroups gmane.comp.db.sqlite.general
Message-ID <[email protected]>
> On Feb 5, 2020, at 9:58 AM, Keith Medcalf <[email protected]> wrote:
> 
> It seems that "column affinities" are not respected in Virtual Table implementations -- that is the value that is returned is the datatype provided by the the vtab_cursor sqlite3_result_* function and the "column affinity" from the vtab declaration is not applied.

The vtab implementation is responsible for generating the CREATE TABLE statement and passing it to sqlite3_declare_vtab(). It’s also responsible for returning column values. So I think the assumption is that it’s up to the implementation to be self-consistent, i.e. returning column values that match the declaration.

I haven’t used the CSV vtable. It looks as though its CREATE VIRTUAL TABLE statement takes a ‘schema’ parameter containing the SQL table declaration, that it then passes straight through to sqlite3_declare_vtab(). It probably doesn’t parse that declaration or figure out from it what the declared types of the columns are.

In other words this looks like a limitation of the CSV implementation, which is perhaps unusual in that it is not in control of the table schema it declares.

—Jens
_______________________________________________
sqlite-users mailing list
[email protected]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.