Re: [sqlite] database file header: "schema layer file format" anomaly

2009-05-26 Thread John Machin
On 27/05/2009 3:03 AM, D. Richard Hipp wrote:
> John - what were you doing when you discovered this?
> 
> On May 26, 2009, at 10:57 AM, John Machin wrote:
> 
>> According to the file format document
>> (http://www.sqlite.org/fileformat.html): "[H30120] The 4 byte block
>> starting at byte offset 44 of a well-formed database file, the schema
>> layer file format, contains a big-endian integer value between 1 and  
>> 4,
>> inclusive."
>>
>> However it is possible to end up with this being zero, e.g. by  
>> dropping
>> all tables/etc and then doing a VACUUM:

Eyeballing the following output from my code:

 assert 1 <= self.schema_layer_file_format <= 4
AssertionError

Cheers,
John
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] database file header: "schema layer file format" anomaly

2009-05-26 Thread D. Richard Hipp
John - what were you doing when you discovered this?

On May 26, 2009, at 10:57 AM, John Machin wrote:

> According to the file format document
> (http://www.sqlite.org/fileformat.html): "[H30120] The 4 byte block
> starting at byte offset 44 of a well-formed database file, the schema
> layer file format, contains a big-endian integer value between 1 and  
> 4,
> inclusive."
>
> However it is possible to end up with this being zero, e.g. by  
> dropping
> all tables/etc and then doing a VACUUM:
>
> # Assume vacked.db doesn't exist
> DOS-prompt>sqlite3 vacked.db
> SQLite version 3.6.14
> Enter ".help" for instructions
> Enter SQL statements terminated with a ";"
> sqlite> create table foo (x, y);
> sqlite> insert into foo values(1, 2);
> sqlite> drop table foo;
> sqlite> vacuum;
> sqlite> ^Z
>
> This seems very much a corner case and I don't imagine this is a  
> problem
> in practice; any concern about this number being when it is too high  
> for
> the software opening the file, and as far as I can guess there is no
> "too low" problem -- however in my opinion differences between such
> documents and reality should always be reported, so here it is.

D. Richard Hipp
d...@hwaci.com



___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


Re: [sqlite] database file header: "schema layer file format" anomaly

2009-05-26 Thread Dan

On May 26, 2009, at 9:57 PM, John Machin wrote:

> According to the file format document
> (http://www.sqlite.org/fileformat.html): "[H30120] The 4 byte block
> starting at byte offset 44 of a well-formed database file, the schema
> layer file format, contains a big-endian integer value between 1 and  
> 4,
> inclusive."
>
> However it is possible to end up with this being zero, e.g. by  
> dropping
> all tables/etc and then doing a VACUUM:
>
> # Assume vacked.db doesn't exist
> DOS-prompt>sqlite3 vacked.db
> SQLite version 3.6.14
> Enter ".help" for instructions
> Enter SQL statements terminated with a ";"
> sqlite> create table foo (x, y);
> sqlite> insert into foo values(1, 2);
> sqlite> drop table foo;
> sqlite> vacuum;
> sqlite> ^Z
>
> This seems very much a corner case and I don't imagine this is a  
> problem
> in practice; any concern about this number being when it is too high  
> for
> the software opening the file, and as far as I can guess there is no
> "too low" problem -- however in my opinion differences between such
> documents and reality should always be reported, so here it is.

As you say, probably not important in practice but still worth getting
right. Thanks for reporting this.

Dan.


___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] database file header: "schema layer file format" anomaly

2009-05-26 Thread John Machin
According to the file format document 
(http://www.sqlite.org/fileformat.html): "[H30120] The 4 byte block 
starting at byte offset 44 of a well-formed database file, the schema 
layer file format, contains a big-endian integer value between 1 and 4, 
inclusive."

However it is possible to end up with this being zero, e.g. by dropping 
all tables/etc and then doing a VACUUM:

# Assume vacked.db doesn't exist
DOS-prompt>sqlite3 vacked.db
SQLite version 3.6.14
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> create table foo (x, y);
sqlite> insert into foo values(1, 2);
sqlite> drop table foo;
sqlite> vacuum;
sqlite> ^Z

This seems very much a corner case and I don't imagine this is a problem 
in practice; any concern about this number being when it is too high for 
the software opening the file, and as far as I can guess there is no 
"too low" problem -- however in my opinion differences between such 
documents and reality should always be reported, so here it is.

Cheers,
John
___
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users