Virtual Table without rowid
(1) By anonymous on 2022-03-19 14:24:57 [link] [source]
Hello,
Documentation states that xRowid
is mandatory:
https://sqlite.org/vtab.html#xrowid
> The xRowid method is required for every virtual table implementation.
But zipfile
implementation doesn't have one:
https://sqlite.org/src/file?udc=1&ci=trunk&name=ext%2Fmisc%2Fzipfile.c
0, /* xRowid - read data */
WITHOUT ROWID
is used in SQL declaration:
"z HIDDEN" /* 7: Name of zip file */
") WITHOUT ROWID;";
Could you please confirm that the documentation is not up to date ?
Thanks.
(2) By anonymous on 2022-03-19 21:14:34 in reply to 1 [link] [source]
I think that you do not (and should not) need xRowid
if it is WITHOUT ROWID
. However, the documentation does not mention that.
(3) By Bjoern Hoehrmann (bjoern) on 2022-03-23 01:46:40 in reply to 1 [source]
Beginning with SQLite version 3.14.0 (2016-08-08), the CREATE TABLE statement that is passed into sqlite3_declare_vtab() may contain a WITHOUT ROWID clause. This is useful for cases where the virtual table rows cannot easily be mapped into unique integers. A CREATE TABLE statement that includes WITHOUT ROWID must define one or more columns as the PRIMARY KEY. Every column of the PRIMARY KEY must individually be NOT NULL and all columns for each row must be collectively unique.
The zip extension ostensibly does the latter.
The documentation unfortunately does not say how the rowid is used for read-only tables.