While it does not provide an example for attached databases, this statement 
from documentation seems to apply:

"The PRAGMA argument and schema, if any, are passed as arguments to the 
table-valued function."

Maybe you should be doing something similar to

Select pragma_user_version('main'), pragma_user_version('test_db');

-----Original Message-----
From: sqlite-users [mailto:sqlite-users-boun...@mailinglists.sqlite.org] On 
Behalf Of Peter Gunold
Sent: Freitag, 22. Februar 2019 14:29
To: sqlite-users@mailinglists.sqlite.org
Subject: [EXTERNAL] [sqlite] Bug: table-valued functions for PRAGMA ignore 
database names

Hello,

I found a bug in sqlite when using table-values pragma functions with attached 
databases when using the sqlite3.exe for windows.
In my tests I found out, that it is not possible to use table-valued pragma 
functions on attached databases e.g. to read user_version or schema_version.

So the Query:

SELECT a.user_version as 'main_version', b.user_version as 'attached_version' 
FROM
          main.pragma_user_version() as 'a',
       test_db.pragma_user_version() as 'b';

Should display the user_version of main-database and attached database as wel, 
but both values display always the version of the main database.

I tested this with 2 szenarios, first with attaching a in-memory database and 
second with attaching a physical database.
Results are identical for both.




Infos about test envoirement

OS:        Windows XP Professional Service Pack 3 (32-Bit)
Sqlite-Version:    3.27.1 2019-02-08 13:17:39
0eca3dd3d38b31c92b49ca2d311128b74584714d9e7de895b1a6286ef959a1dd
Test-Command:    sqlite3 -echo bug_test.db < pragma_bug-testcase.sql



To make it easy to reconstruct this Bug I added example outputs and my 
inputs-commands (as sql file) for sqlite3.exe.

Simply run
"sqlite3 -echo bug_test.db < pragma_bug-testcase.sql"

on any test-databse and compare results to my "test-ouputs" for szenario 1 and 
szenario 2.


___________________________________________
 Gunter Hick | Software Engineer | Scientific Games International GmbH | 
Klitschgasse 2-4, A-1130 Vienna | FN 157284 a, HG Wien, DVR: 0430013 | (O) +43 
1 80100 - 0

May be privileged. May be confidential. Please delete if not the addressee.
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to