On Thu, Sep 30, 2010 at 05:47:49PM +0200, TP scratched on the wall:
> Hi everybody,
> 
> Apart from parsing the SQL definition of a table obtained with 
> sqlite_master, is there any means to obtain directly the primary key of a 
> table? I have not found any PRAGMA allowing that.

  The sixth column of the output of "PRAGMA table_info( <table> )".
  Each column of <table> will return one row.  The last column of the
  output will have a value of 1 (true) if that row's column is part of
  the PK, or 0 (false) if that row's column is not part of the PK.

  Remember that a PK might consist of more than one column.


  Yes, I know, the docs <http://sqlite.org/pragma.html#pragma_table_info>
  fail to mention the PK column.

   -j

-- 
Jay A. Kreibich < J A Y  @  K R E I B I.C H >

"Intelligence is like underwear: it is important that you have it,
 but showing it to the wrong people has the tendency to make them
 feel uncomfortable." -- Angela Johnson
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to