On Tue, Apr 30, 2013 at 10:13 PM, Joey Adams <[email protected]>wrote:
> The documentation for PRAGMA table_info says: The 'pk' column in the result > set is zero for columns that are not part of the primary key, and is the > index of the column in the primary key for columns that are part of the > primary key." But in reality, pk = 1 for all the primary key columns: > For SQLite 3.7.15 and earlier, the "pk" columns meaning was undocumented and hence undefined. As it happened it was always 1. Beginning with SQLite 3.7.16 we defined the meaning of the "pk" column to be the 1-based index of the column in the primary key. > > SQLite version 3.7.15.2 2013-01-09 11:53:05 > Enter ".help" for instructions > Enter SQL statements terminated with a ";" > sqlite> .mode column > sqlite> .header on > sqlite> CREATE TABLE foo (a INT, b INT, PRIMARY KEY(a,b)); > sqlite> PRAGMA table_info(foo); > cid name type notnull dflt_value pk > ---------- ---------- ---------- ---------- ---------- ---------- > 0 a INT 0 1 > 1 b INT 0 1 > _______________________________________________ > sqlite-users mailing list > [email protected] > http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users > -- D. Richard Hipp [email protected] _______________________________________________ sqlite-users mailing list [email protected] http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

