"PRAGMA data_version" documentation wrong

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

"PRAGMA data_version" documentation wrong

Jim Dossey
I think the documentation for "PRAGMA data_version" at
https://www.sqlite.org/pragma.html is incorrect.  I've been testing this
pragma and I've found that it only returns '1' for a standard database
or '2' if the database is in WAL mode.  The documentation makes it sound
like this value changes every time a COMMIT is made to the database.  It
could be that I just don't understand what it is supposed to do.  I'm
new to sqlite and SQL in general, so I've been trying different things
to see how they work.

Broadcasters General Store, Inc. Disclaimer  -  This message contains confidential information and is intended only for the individual(s) named.  If you are not the named addressee you should not disseminate, distribute or copy this e-mail.  Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system.  If you are not the intended recipient you are notified that disclosing, copying, distributing or taking any action in reliance on the contents of this information is strictly prohibited.

_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: "PRAGMA data_version" documentation wrong

Simon Slavin-3


On 20 Nov 2017, at 6:20pm, Jim Dossey <[hidden email]> wrote:

> I think the documentation for "PRAGMA data_version" at https://www.sqlite.org/pragma.html is incorrect.  I've been testing this pragma and I've found that it only returns '1' for a standard database or '2' if the database is in WAL mode.  The documentation makes it sound like this value changes every time a COMMIT is made to the database.

Not quite:

<https://www.sqlite.org/pragma.html#pragma_data_version>

" The "PRAGMA data_version" value is unchanged for commits made on the same database connection. The behavior of "PRAGMA data_version" is the same for all database connections, including database connections in separate processes and shared cache database connections. "

The idea is that the version is not incremented every time a change is made.  It is incremented one every time a particular connection makes any changes.

To test it out you would need to maintain two connections to the database file and alternate which one writes to the database.  You should be able to test this using two copies of the SQLite command-line tool running at the same time.

Simon.
_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
Reply | Threaded
Open this post in threaded view
|

Re: "PRAGMA data_version" documentation wrong

Dan Kennedy-4
In reply to this post by Jim Dossey
On 11/21/2017 01:20 AM, Jim Dossey wrote:

> I think the documentation for "PRAGMA data_version" at
> https://www.sqlite.org/pragma.html is incorrect.  I've been testing
> this pragma and I've found that it only returns '1' for a standard
> database or '2' if the database is in WAL mode.  The documentation
> makes it sound like this value changes every time a COMMIT is made to
> the database.  It could be that I just don't understand what it is
> supposed to do.  I'm new to sqlite and SQL in general, so I've been
> trying different things to see how they work.
>
> Broadcasters General Store, Inc. Disclaimer  -  This message contains
> confidential information and is intended only for the individual(s)
> named.  If you are not the named addressee you should not disseminate,
> distribute or copy this e-mail.  Please notify the sender immediately
> by e-mail if you have received this e-mail by mistake and delete this
> e-mail from your system.  If you are not the intended recipient you
> are notified that disclosing, copying, distributing or taking any
> action in reliance on the contents of this information is strictly
> prohibited.
>
> _______________________________________________
> sqlite-users mailing list
> [hidden email]
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


As well as Simon's answer, you might be interested in this thread from
earlier this month:

http://sqlite.1065341.n5.nabble.com/Most-efficient-way-to-detect-on-disk-change-td98413.html

Dan.




_______________________________________________
sqlite-users mailing list
[hidden email]
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users