Am 26.11.2015 um 01:30 schrieb Simon Slavin:
>
> On 25 Nov 2015, at 8:25pm, Ulrich Telle <ulrich.telle at gmx.de> wrote:
>
>> SELECT name, rootpage, sql FROM 'main'.sqlite_master ORDER BY rowid
>
> Can you try that again without the quotes around "main" ?
>
> SELECT name, rootpage, sql FROM main.sqlite_master ORDER BY rowid
No. The reason is that this is an SQL statement generated by SQLite
itself internally while initializing an empty database.
In fact, I finally found out that the lines 379-384 in build.c (or
93143-93148 in the amalgamation) are the cause of the problem:
#if SQLITE_USER_AUTHENTICATION
else if( pParse->db->auth.authLevel<UAUTH_User ){
sqlite3ErrorMsg(pParse, "user not authenticated");
p = 0;
}
#endif
This code "worked" in prior versions (before 3.9.0), because the symbol
SQLITE_USER_AUTHENTICATION was misspelled as SQLITE_USER_AUTHENICATION
... and the code was not executed at all.
The problem is that during initialization of a new database the value of
authLevel is still 0. In that case the check should either not be
prformed at all, or the user authentication should be initialized:
a) Change line 380 to:
else if( pParse->db->auth.authLevel!=0 &&
pParse->db->auth.authLevel<UAUTH_User ){
or
b) Add initialization
#if SQLITE_USER_AUTHENTICATION
else {
if( pParse->db->auth.authLevel==UAUTH_Unknown ){
sqlite3UserAuthInit(pParse->db);
}
if( pParse->db->auth.authLevel<UAUTH_User ){
sqlite3ErrorMsg(pParse, "user not authenticated");
p = 0;
}
}
#endif
Probably something like b) should be preferred. However, I really don't
know whether other conditions have to be checked before calling
sqlite3UserAuthInit. I assume the SQLite developers will know that.
Regards,
Ulrich