As I reported on sqlite page (and the ticket was deleted - this is my first
bug report for sqlite, so I don't have experience with this), there is a
problem with PRAGMA table_info('table_name'); (even on latest version -
3.7.15.2).
When you open sqlite db with two processes then add column to table from
one. Both processes returns different number of columns if you call PRAGMA
table_info('table_name'); new column is not added to connection where
column wasn't created. Any SELECT from table or even PRAGMA quick_ckeck;
will solve this behaviour. It looks like results of table_info are cached
somewhere.


Example of bug:

1) open both process
process1: command -  sqlite3 test.db
process2: command - sqlite3 test.db

2) add column to first table and test PRAGMA table_info in process1
process1 sqlite command:
ALTER TABLE "table" ADD COLUMN test TEXT;
---> result: empty
PRAGMA table_info("table");
---> result:
cid: 0, name: column0, type: TEXT, dflt_value: NULL, pk: 0
.
.
.
.
.
cid 10, name: ATEST, type: TEXT, dflt_value: NULL, pk: 0

3) test PRAGMA table_info in process2
PRAGMA table_info("table") ;
---> result:
cid: 0, name: column0, type: TEXT, dflt_value: NULL, pk: 0
.
.
.
.
.
/*--------------- THIS IS MISSING --------------- cid 10, name: ATEST,
type: TEXT, dflt_value: NULL, pk: 0*/
PRAGMA quick_check;
----> result: ok
PRAGMA table_info("table") ;
cid: 0, name: column0, type: TEXT, dflt_value: NULL, pk: 0
.
.
.
.
.
/*-------------- NOW OK --------------------------*/ cid 10, name: ATEST,
type: TEXT, dflt_value: NULL, pk: 0


If you don't find this as a bug, but as intended behaviour of sqlite,
please email me back. Possilby with recommend way for accessing table
metadata, instead of pragma table_info;
Many thanks
Filip Arlet
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to