Re: How to identify primary key
| From: | Hans Lellelid | Date: | Wed, 02 Jun 2004 00:03:07 +0000 |
| Subject: | Re: How to identify primary key | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-34624@lists.php.net to get a copy of this message | ||
Hi,
Scot L. Harris wrote:
Using PHP 4.2.2 and postgresql 7.2.4. Trying to find a way to identify the primary key of a table given just the tables name.I don't have a quick answer but can point you to where you can hopefully find what you are looking for. Try looking at the queries in this class: http://creole.tigris.org/source/browse/creole/creole/classes/creole/drivers/pgsql/metadata/PgSQLTableInfo.php Creole is a PHP5 db abstraction layer that, among other things, has methods to get primary key info from db metadata. I think the answer to your question (and possibly others about pgsql metadta) will be present in that class. I had some help in getting that to work correctly. Cheers, Hans